Skip to content

Commit

Permalink
Merge pull request #18 from xx45/dev
Browse files Browse the repository at this point in the history
test(fix test): fix test millisecond
  • Loading branch information
iamkun authored Apr 13, 2018
2 parents d63456a + 5ad890e commit 680d302
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"eslint-plugin-import": "^2.10.0",
"eslint-plugin-jest": "^21.15.0",
"jest": "^22.4.3",
"mockdate": "^2.0.2",
"moment": "^2.22.0",
"pre-commit": "^1.2.2",
"rollup": "^0.57.1",
Expand Down
9 changes: 9 additions & 0 deletions test/display.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import moment from 'moment'
import MockDate from 'mockdate'
import dayjs from '../src'

beforeEach(() => {
MockDate.set(new Date())
})

afterEach(() => {
MockDate.reset()
})

test('Format no formatStr', () => {
expect(dayjs().format()).toBe(moment().format())
})
Expand Down
9 changes: 9 additions & 0 deletions test/get-set.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import moment from 'moment'
import MockDate from 'mockdate'
import dayjs from '../src'

beforeEach(() => {
MockDate.set(new Date())
})

afterEach(() => {
MockDate.reset()
})

test('Year', () => {
expect(dayjs().year()).toBe(moment().year())
})
Expand Down
9 changes: 9 additions & 0 deletions test/manipulate.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import moment from 'moment'
import MockDate from 'mockdate'
import dayjs from '../src'

beforeEach(() => {
MockDate.set(new Date())
})

afterEach(() => {
MockDate.reset()
})

test('StartOf Year', () => {
expect(dayjs().startOf('year').unix()).toBe(moment().startOf('year').unix())
})
Expand Down
9 changes: 9 additions & 0 deletions test/parse.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import moment from 'moment'
import MockDate from 'mockdate'
import dayjs from '../src'

beforeEach(() => {
MockDate.set(new Date())
})

afterEach(() => {
MockDate.reset()
})

test('Now', () => {
expect(dayjs().unix()).toBe(moment().unix())
})
Expand Down

0 comments on commit 680d302

Please sign in to comment.