Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeEach(async function() {
mockdate.set("2015-11-05");
mailChecker = sinon.stub( mailReceiver.for_test_only.transporter,"sendMail")
.callsFake(function(obj, doit) { return doit(null, {response: "t"}); })
await testutil.clearDB();
await userModule.createNewUser({OSMUser: "TheFive", access: "full"});
await articleModule.createNewArticle({blog: "blog", collection: "test"});
testutil.startServerSync();
browser = await testutil.getNewBrowser("TheFive");
browser.evaluate(fs.readFileSync("./node_modules/timemachine/timemachine.js","UTF8"));
});
afterEach(function(bddone) {
it('accept no arguments', () => {
MockDate.set(new Date(2015, 0).valueOf())
expect(
matrix(undefined, true).toString()
).toEqual(jan15.toString())
MockDate.reset()
})
})
beforeEach(() => {
mockDate.set(1514764800000, 0);
});
before(() => {
MockDate.set(new Date());
dateModified = getFormattedDateTime();
});
after(() => MockDate.reset());
beforeEach(() => {
mockDate.set(1514764800000, 0);
});
test.before(() => {
mockery.enable({
warnOnReplace: false,
warnOnUnregistered: false,
useCleanCache: true
})
mockdate.set(new Date(1427749200000))
})
export function resetMockDate() {
MockDate.reset();
}
MockDate.set(10000000)
const api = setup({
baseURL: 'https://httpbin.org',
cache: { readHeaders: true }
})
const response = await api.get('/cache/2345')
assert.ok(!response.request.fromCache)
const item = await api.cache.getItem('https://httpbin.org/cache/2345')
assert.equal(item.expires, 12345000)
MockDate.reset()
})
afterEach(() => {
MockDate.reset();
return unloadFixtures(fixtures);
});
});
it('should fail if startTime is previous than current time', () => {
const values = {
tiers: [
{
startTime: TIMESTAMPS.CURRENT_TIME,
endTime: TIMESTAMPS.PLUS_5_MINUTES,
},
{
startTime: TIMESTAMPS.PLUS_5_MINUTES,
endTime: TIMESTAMPS.PLUS_10_DAYS,
},
]
}
MockDate.set(TIMESTAMPS.PLUS_5_MINUTES)
const validationResult = validateTierStartDate(0)(values.tiers[0].startTime, values)
expect(validationResult).toEqual([VALIDATION_MESSAGES.DATE_IN_FUTURE])
})