2020-01-10 04:54:58 -05:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
2020-03-04 07:35:52 -05:00
|
|
|
import {FileSystem} from '../../../src/ngtsc/file_system';
|
2020-03-04 07:49:36 -05:00
|
|
|
import {LockFile} from '../../src/locking/lock_file';
|
2020-01-10 04:54:58 -05:00
|
|
|
|
2020-03-04 07:35:52 -05:00
|
|
|
/**
|
|
|
|
* A mock implementation of `LockFile` that just logs its calls.
|
|
|
|
*/
|
|
|
|
export class MockLockFile implements LockFile {
|
|
|
|
constructor(
|
|
|
|
fs: FileSystem, private log: string[] = [], public path = fs.resolve('/lockfile'),
|
|
|
|
private pid = '1234') {}
|
2020-04-06 03:30:08 -04:00
|
|
|
write() {
|
|
|
|
this.log.push('write()');
|
|
|
|
}
|
2020-03-04 07:35:52 -05:00
|
|
|
read(): string {
|
|
|
|
this.log.push('read()');
|
|
|
|
return this.pid;
|
2020-02-03 15:25:15 -05:00
|
|
|
}
|
2020-04-06 03:30:08 -04:00
|
|
|
remove() {
|
|
|
|
this.log.push('remove()');
|
|
|
|
}
|
2020-02-03 15:25:15 -05:00
|
|
|
}
|