mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-20 08:13:46 +00:00
Migrate update-lock tests as integration tests
Update-lock tests now use the actual filesystem for testing, instead of relying on stubs and spies. This commit also fixes a small bug with update-lock that would cause a `PromiseRejectionHandledWarning` when the lock callback would throw.
This commit is contained in:
17
test/unit/lib/update-lock.spec.ts
Normal file
17
test/unit/lib/update-lock.spec.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { expect } from 'chai';
|
||||
import * as path from 'path';
|
||||
|
||||
import * as updateLock from '~/lib/update-lock';
|
||||
|
||||
describe('lib/update-lock: unit tests', () => {
|
||||
describe('lockPath', () => {
|
||||
it('should return path prefix of service lockfiles on host', () => {
|
||||
expect(updateLock.lockPath(123)).to.equal(
|
||||
path.join(updateLock.BASE_LOCK_DIR, '123'),
|
||||
);
|
||||
expect(updateLock.lockPath(123, 'main')).to.equal(
|
||||
path.join(updateLock.BASE_LOCK_DIR, '123', 'main'),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user