Test fix
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-11-04 14:38:15 +01:00
parent 47b845da46
commit c77cd696c7
1 changed files with 4 additions and 8 deletions

View File

@ -2,15 +2,11 @@ const app = require('vn-loopback/server/server');
describe('campaign upcoming()', () => { describe('campaign upcoming()', () => {
it('should return the upcoming campaign but from the last year', async() => { it('should return the upcoming campaign but from the last year', async() => {
let response = await app.models.Campaign.upcoming(); const response = await app.models.Campaign.upcoming();
const lastYearDate = new Date();
lastYearDate.setFullYear(lastYearDate.getFullYear() - 1);
const lastYear = lastYearDate.getFullYear();
const campaignDated = response.dated; const campaignDated = response.dated;
const campaignYear = campaignDated.getFullYear(); const now = new Date();
expect(campaignYear).toEqual(lastYear); expect(campaignDated).toEqual(jasmine.any(Date));
expect(campaignDated).toBeLessThanOrEqual(now);
}); });
}); });