forked from webpack/webpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCachePlugin.unittest.js
40 lines (32 loc) · 1.01 KB
/
CachePlugin.unittest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"use strict";
const CachePlugin = require("../lib/CachePlugin");
describe("CachePlugin", () => {
let env;
beforeEach(() => {
env = {
compilation: {
compiler: {},
warnings: []
}
};
});
describe("applyMtime", () => {
beforeEach(() => (env.plugin = new CachePlugin()));
it("sets file system accuracy to 1 for granular modification timestamp", () => {
env.plugin.applyMtime(1483819067001);
expect(env.plugin.FS_ACCURACY).toBe(1);
});
it("sets file system accuracy to 10 for moderately granular modification timestamp", () => {
env.plugin.applyMtime(1483819067004);
expect(env.plugin.FS_ACCURACY).toBe(10);
});
it("sets file system accuracy to 100 for moderately coarse modification timestamp", () => {
env.plugin.applyMtime(1483819067040);
expect(env.plugin.FS_ACCURACY).toBe(100);
});
it("sets file system accuracy to 1000 for coarse modification timestamp", () => {
env.plugin.applyMtime(1483819067400);
expect(env.plugin.FS_ACCURACY).toBe(1000);
});
});
});