mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-29 10:08:52 +00:00
988a1c9e9a
This updates balena lint to the latest version to enable eslint support and unblock Typescript updates. This is a huge number of changes as the linting rules are much more strict now, requiring modifiying most files in the codebase. This commit also bumps the test dependency `rewire` as that was interfering with the update of balena-lint Change-type: patch
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import { expect } from 'chai';
|
|
import type { TestFs } from 'mocha-pod';
|
|
import { testfs } from 'mocha-pod';
|
|
|
|
import * as osRelease from '~/lib/os-release';
|
|
|
|
describe('lib/os-release', () => {
|
|
let tfs: TestFs.Enabled;
|
|
before(async () => {
|
|
tfs = await testfs({
|
|
'/etc/os-release': testfs.from('test/data/etc/os-release-tx2'),
|
|
}).enable();
|
|
});
|
|
|
|
after(async () => {
|
|
await tfs.restore();
|
|
});
|
|
|
|
it('gets pretty name', async () => {
|
|
// Try to get PRETTY_NAME
|
|
await expect(osRelease.getOSVersion('/etc/os-release')).to.eventually.equal(
|
|
'balenaOS 2.45.1+rev3',
|
|
);
|
|
});
|
|
|
|
it('gets variant', async () => {
|
|
// Try to get VARIANT_ID
|
|
await expect(osRelease.getOSVariant('/etc/os-release')).to.eventually.equal(
|
|
'prod',
|
|
);
|
|
});
|
|
|
|
it('gets version', async () => {
|
|
// Try to get VERSION
|
|
await expect(osRelease.getOSSemver('/etc/os-release')).to.eventually.equal(
|
|
'2.45.1+rev3',
|
|
);
|
|
});
|
|
|
|
it('gets meta release version', async () => {
|
|
// Try to get META_BALENA_VERSIONS
|
|
await expect(
|
|
osRelease.getMetaOSRelease('/etc/os-release'),
|
|
).to.eventually.equal('2.45.1');
|
|
});
|
|
});
|