Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tests): advance the future time by 1000 yrs #3410

Merged
merged 1 commit into from
Jan 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is advancing the future time by 1000 years. The commit message needs to be updated. Please also update the PR description.

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