This project is init with mongoose: 5.10.4
and one test case to run, this is to demo the test passes before upgrading to 5.10.5
and different sinon.useFakeTimers
configuration
Uses 3 key library: mongoose, sinon and node-schedule
Use mongoose
to create new doc, use node-schedule
to schedule an update at a later time, and lastly, use sinon.useFakeTimers
to mock time
- npm i
- npm run test
- test pass
- update
mongoose
to5.10.5
inpackage.json
- npm i
skip
the first test, removeskip
from second test- test fail
skip
first two test- enable third test
- run test
- test fail (mocking
Date
only, scheduler doesn't seem to take effect)
skip
all test except last- run test
- test pass (this is with mocking both
Date
andsetTimeout
)