mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
wip: code formatting nits continued
This commit is contained in:
25
test/now.spec.js
Normal file
25
test/now.spec.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import { _, stubA } from './utils';
|
||||
|
||||
describe('now', () => {
|
||||
it('should return the number of milliseconds that have elapsed since the Unix epoch', (done) => {
|
||||
const stamp = +new Date();
|
||||
const actual = _.now();
|
||||
|
||||
expect(actual >= stamp);
|
||||
|
||||
setTimeout(() => {
|
||||
expect(_.now() > actual);
|
||||
done();
|
||||
}, 32);
|
||||
});
|
||||
|
||||
it('should work with mocked `Date.now`', () => {
|
||||
const now = Date.now;
|
||||
Date.now = stubA;
|
||||
|
||||
const actual = _.now();
|
||||
Date.now = now;
|
||||
|
||||
expect(actual).toBe('a');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user