apc-domain
Version:
APC Domain Information Package
77 lines (66 loc) • 3.75 kB
JavaScript
// const chai = require('chai')
// const Services = require('../src/Services.js')
// const Moment = require('moment')
// describe('Test Services.GetServiceDetails', async () => {
// const nextDayServices = ['ND09','ND10','ND16', 'CP09','CP10','CP12','CP16','MP09','MP10','MP12','MP16']
// nextDayServices.forEach(code => {
// it( code + ' Should return min 1 day', function() {
// let ND10Window = Services.GetServiceDetails('ND10')
// chai.expect(ND10Window.MinDays).to.equal(1)
// });
// })
// const nextDaySixteenHundredServices = ['ND16','CP16','MP16']
// nextDaySixteenHundredServices.forEach(code => {
// it( 'XX16 codes should return a delivery window up until midnight. (' + code + ')', function() {
// let ND10Window = Services.GetServiceDetails(code)
// chai.expect(ND10Window.LatestTime).to.equal('23:59:59')
// });
// })
// it ('Should error for unrecognised service code', async () => {
// chai.assert.throws(() => { Services.GetServiceDetails('LOLCAT')}, 'Service code not recognised')
// })
// })
// describe('Test Services.CalculateDeliveryDateTime ', async () => {
// it ('For Delivery on Thursday Before Good Friday - Delivery should be Tuesday after Easter Monday', async () => {
// var ShipDate = Moment('2019-04-18', 'YYYY-MM-DD');
// debugger
// let ND9Window = await Services.CalculateDeliveryDateTime ("ND09", ShipDate, true)
// chai.expect(ND9Window.year()).to.equal(2019)
// chai.expect(ND9Window.month()).to.equal(3) // 0 based
// chai.expect(ND9Window.date()).to.equal(23)
// chai.expect(ND9Window.hour()).to.equal(9)
// chai.expect(ND9Window.minute()).to.equal(30)
// })
// it ('Should work with Easter weekend ', async () => {
// // 18 April in
// // 23 April out
// let DeliveryDate = await Services.CalculateDeliveryDateTime('ND09', Moment('18-04-2019', 'DD-MM-YYYY'))
// chai.expect(DeliveryDate.format('DD-MM-YYYY HH:mm:ss')).to.equal('23-04-2019 09:00:00')
// })
// it ('ND09 without Grace Window should return 9:00', async () => {
// var ShipDate = Moment('2019-04-01', 'YYYY-MM-DD');
// debugger
// let ND9Window = await Services.CalculateDeliveryDateTime ("ND09", ShipDate, false)
// chai.expect(ND9Window.year()).to.equal(2019)
// chai.expect(ND9Window.month()).to.equal(3) // 0 based
// chai.expect(ND9Window.date()).to.equal(2)
// chai.expect(ND9Window.hour()).to.equal(9)
// chai.expect(ND9Window.minute()).to.equal(00)
// })
// })
// describe('Test Calculate Delivery date/time for service code and date', async () => {
// it ('Should return next day for a normal Monday', async () => {
// let DeliveryDate = await Services.CalculateDeliveryDateTime('ND09', Moment('25-11-2019', 'DD-MM-YYYY'))
// chai.expect(DeliveryDate.format('DD-MM-YYYY HH:mm:ss')).to.equal('26-11-2019 09:00:00')
// })
// it ('Should work Next Day with August bank holiday', async () => {
// let DeliveryDate = await Services.CalculateDeliveryDateTime('ND09', Moment('23-08-2019', 'DD-MM-YYYY'))
// chai.expect(DeliveryDate.format('DD-MM-YYYY HH:mm:ss')).to.equal('27-08-2019 09:00:00')
// })
// it ('Should work with a 2-5 day on the August Bank holiday 2019', async () => {
// let DeliveryDate = await Services.CalculateDeliveryDateTime('ECS ', Moment('23-08-2019', 'DD-MM-YYYY'))
// chai.expect(DeliveryDate.format('DD-MM-YYYY HH:mm:ss')).to.equal('29-08-2019 23:59:59') // 29th August
// })
// // it ('Should work with a 2-5 day on easter weekend 2019')
// // it ('Should work over the christmas period 2019') ?????
// })