Skip to content

Commit

Permalink
chore(tests): advance the future time by 1000 yrs (karma-runner#3410)
Browse files Browse the repository at this point in the history
5 years ago some one set the test file time to 2020. And here we are.
  • Loading branch information
johnjbarton committed Jan 22, 2020
1 parent 80febfb commit 7ea120b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/unit/file-list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -596,13 +596,13 @@ describe('FileList', () => {
emitter.on('file_list_modified', modified)

return list.refresh().then((files) => {
mockFs._touchFile('/some/b.js', '2020-01-01')
mockFs._touchFile('/some/b.js', '3020-01-01')
modified.resetHistory()

return list.changeFile('/some/b.js').then((files) => {
clock.tick(101)
expect(modified).to.have.been.calledOnce
expect(findFile('/some/b.js', files.served).mtime).to.be.eql(new Date('2020-01-01'))
expect(findFile('/some/b.js', files.served).mtime).to.be.eql(new Date('3020-01-01'))
})
})
})
Expand All @@ -615,7 +615,7 @@ describe('FileList', () => {
emitter.on('file_list_modified', modified)

return list.refresh().then((files) => {
mockFs._touchFile('/some/b.js', '2020-01-01')
mockFs._touchFile('/some/b.js', '3020-01-01')
modified.resetHistory()

return list.changeFile('/some/b.js').then(() => {
Expand Down Expand Up @@ -665,7 +665,7 @@ describe('FileList', () => {

return list.refresh().then((files) => {
preprocess.resetHistory()
mockFs._touchFile('/some/a.js', '2020-01-01')
mockFs._touchFile('/some/a.js', '3020-01-01')
return list.changeFile('/some/a.js').then(() => {
expect(preprocess).to.have.been.called
expect(preprocess.lastCall.args[0]).to.have.property('path', '/some/a.js')
Expand Down Expand Up @@ -855,7 +855,7 @@ describe('FileList', () => {
expect(modified).to.not.have.been.called

// Modify file, must change mtime too, or change is ignored
mockFs._touchFile('/some/0.js', '2020-01-01')
mockFs._touchFile('/some/0.js', '3020-01-01')
list.changeFile('/some/0.js').then(() => {
// Ensure that the debounce timer was reset
clock.tick(2)
Expand All @@ -870,7 +870,7 @@ describe('FileList', () => {

// Modify file (one hour later mtime)
expect(modified).to.have.been.calledOnce
mockFs._touchFile('/some/0.js', '2020-01-02')
mockFs._touchFile('/some/0.js', '3020-01-02')
list.changeFile('/some/0.js').then(() => {
clock.tick(99)
expect(modified).to.have.been.calledOnce
Expand All @@ -892,7 +892,7 @@ describe('FileList', () => {

return list.refresh().then((files) => {
modified.resetHistory()
mockFs._touchFile('/some/b.js', '2020-01-01')
mockFs._touchFile('/some/b.js', '3020-01-01')
list.changeFile('/some/b.js')
list.removeFile('/some/a.js') // /some/b.js, /a.txt
list.removeFile('/a.txt') // /some/b.js
Expand All @@ -901,7 +901,7 @@ describe('FileList', () => {
// /some/0.js, /some/b.js, /a.txt
clock.tick(99)
expect(modified).to.not.have.been.called
mockFs._touchFile('/a.txt', '2020-01-01')
mockFs._touchFile('/a.txt', '3020-01-01')
list.changeFile('/a.txt').then(() => {
clock.tick(2)
expect(modified).to.not.have.been.called
Expand Down

0 comments on commit 7ea120b

Please sign in to comment.