Skip to content

Commit

Permalink
Fix unit tests by mocking the date
Browse files Browse the repository at this point in the history
  • Loading branch information
salbahra committed May 19, 2019
1 parent e28c309 commit 9bbb414
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"dotenv": "^8.0.0",
"express": "^4.16.4",
"geo-tz": "^5.0.4",
"mockdate": "^2.0.2",
"moment-timezone": "^0.5.25",
"suncalc": "^1.8.0"
},
Expand Down
3 changes: 3 additions & 0 deletions routes/weather.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect } from 'chai';
import * as nock from 'nock';
import * as MockExpressRequest from 'mock-express-request';
import * as MockExpressResponse from 'mock-express-response';
import * as MockDate from 'mockdate';

import { getWateringData } from './weather';

Expand All @@ -11,6 +12,8 @@ const replies = require( '../test/replies.json' );
const location = '01002';

describe('Watering Data', () => {
beforeEach(() => MockDate.set('5/13/2019'));

it('OpenWeatherMap Lookup (Adjustment Method 0, Location 01002)', async () => {
mockOWM();

Expand Down

0 comments on commit 9bbb414

Please sign in to comment.