mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2026-10-25 15:05:25 +00:00
20 lines
708 B
TypeScript
20 lines
708 B
TypeScript
import assert from "assert";
|
|
import { describe, it } from "mocha";
|
|
import { FileWorkingStore } from "../../src/worker/builder";
|
|
|
|
// Tools skip a build when no output is newer than its inputs
|
|
// (anyTargetChanged), so a file written later must get a later timestamp,
|
|
// even in the same millisecond.
|
|
describe('FileWorkingStore versions', () => {
|
|
it('should give each new file version a later timestamp', () => {
|
|
const store = new FileWorkingStore();
|
|
let last = 0;
|
|
for (let i = 0; i < 1000; i++) {
|
|
const ts = store.putFile('f' + i, 'x').ts;
|
|
assert.ok(ts > last, `version ${i}: ${ts} <= ${last}`);
|
|
last = ts;
|
|
}
|
|
assert.strictEqual(store.currentVersion(), last);
|
|
});
|
|
});
|