-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
Copy pathfs-normalized.js
42 lines (35 loc) · 1.69 KB
/
fs-normalized.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
41
42
/* @flow */
import {fileDatesEqual} from '../../src/util/fs-normalized.js';
describe('fileDatesEqual', () => {
describe('!win32', () => {
beforeAll(() => {
Object.defineProperty(process, 'platform', {configurable: true, value: 'notWin32'});
});
test('Same dates equal', () => {
expect(fileDatesEqual(new Date(1491393798834), new Date(1491393798834))).toBeTruthy();
expect(fileDatesEqual(new Date(1491393798000), new Date(1491393798000))).toBeTruthy();
});
test('Different dates differ', () => {
expect(fileDatesEqual(new Date(1491393798834), new Date(1491393798835))).toBeFalsy();
expect(fileDatesEqual(new Date(1491393700834), new Date(1491393798834))).toBeFalsy();
expect(fileDatesEqual(new Date(1491393798000), new Date(1491393798835))).toBeFalsy();
});
});
describe('win32', () => {
beforeAll(() => {
Object.defineProperty(process, 'platform', {configurable: true, value: 'win32'});
});
test('Same dates equal', () => {
expect(fileDatesEqual(new Date(1491393798834), new Date(1491393798834))).toBeTruthy();
});
test('Different dates differ', () => {
expect(fileDatesEqual(new Date(1491393798834), new Date(1491393798835))).toBeTruthy();
expect(fileDatesEqual(new Date(1491393798834), new Date(1491393798836))).toBeFalsy();
expect(fileDatesEqual(new Date(1491393700834), new Date(1491393798834))).toBeFalsy();
});
test('Milliseconds are ignored when one date has zero milliseconds', () => {
expect(fileDatesEqual(new Date(1491393798000), new Date(1491393798835))).toBeTruthy();
expect(fileDatesEqual(new Date(1491393798834), new Date(1491393798000))).toBeTruthy();
});
});
});