From c77cd696c7b1f9c5caac7e548b01216f17ddb12d Mon Sep 17 00:00:00 2001 From: joan Date: Wed, 4 Nov 2020 14:38:15 +0100 Subject: [PATCH] Test fix --- back/methods/campaign/spec/upcoming.spec.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/back/methods/campaign/spec/upcoming.spec.js b/back/methods/campaign/spec/upcoming.spec.js index 953683e7a..14bffe3cf 100644 --- a/back/methods/campaign/spec/upcoming.spec.js +++ b/back/methods/campaign/spec/upcoming.spec.js @@ -2,15 +2,11 @@ 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 response = await app.models.Campaign.upcoming(); 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); }); });