salix/back/methods/campaign/spec/upcoming.spec.js

17 lines
561 B
JavaScript
Raw Normal View History

2020-10-05 06:50:07 +00:00
const app = require('vn-loopback/server/server');
describe('campaign upcoming()', () => {
it('should return the upcoming campaign but from the last year', async() => {
let response = await app.models.Campaign.upcoming();
const lastYearDate = new Date();
lastYearDate.setFullYear(lastYearDate.getFullYear() - 1);
const lastYear = lastYearDate.getFullYear();
const campaignDated = response.dated;
const campaignYear = campaignDated.getFullYear();
expect(campaignYear).toEqual(lastYear);
});
});