Changeset View
Changeset View
Standalone View
Standalone View
cypress/integration/origin-save.spec.js
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | describe('Origin Save Tests', function() { | ||||
}); | }); | ||||
beforeEach(function() { | beforeEach(function() { | ||||
cy.fixture('origin-save').as('originSaveJSON'); | cy.fixture('origin-save').as('originSaveJSON'); | ||||
cy.fixture('save-task-info').as('saveTaskInfoJSON'); | cy.fixture('save-task-info').as('saveTaskInfoJSON'); | ||||
cy.visit(url); | cy.visit(url); | ||||
}); | }); | ||||
it('should format appropriately values depending on their type', function() { | |||||
let inputValues = [ // null values stay null | |||||
{type: 'json', value: null, expectedValue: null}, | |||||
{type: 'date', value: null, expectedValue: null}, | |||||
{type: 'raw', value: null, expectedValue: null}, | |||||
{type: 'duration', value: null, expectedValue: null}, | |||||
// non null values formatted depending on their type | |||||
vlorentz: c'mon | |||||
{type: 'json', value: '{}', expectedValue: '"{}"'}, | |||||
{type: 'date', value: '04/04/2021 01:00:00', expectedValue: '4/4/2021, 1:00:00 AM'}, | |||||
{type: 'raw', value: 'value-for-identity', expectedValue: 'value-for-identity'}, | |||||
{type: 'duration', value: '10', expectedValue: '10 seconds'}, | |||||
{type: 'duration', value: 100, expectedValue: '100 seconds'} | |||||
]; | |||||
cy.window().then(win => { | |||||
inputValues.forEach(function(input, index, array) { | |||||
let actualValue = win.swh.save.formatValuePerType(input.type, input.value); | |||||
assert.equal(actualValue, input.expectedValue); | |||||
}); | |||||
}); | |||||
}); | |||||
it('should display accepted message when accepted', function() { | it('should display accepted message when accepted', function() { | ||||
stubSaveRequest({requestUrl: this.originSaveUrl, | stubSaveRequest({requestUrl: this.originSaveUrl, | ||||
saveRequestStatus: 'accepted', | saveRequestStatus: 'accepted', | ||||
originUrl: origin.url, | originUrl: origin.url, | ||||
saveTaskStatus: 'not yet scheduled'}); | saveTaskStatus: 'not yet scheduled'}); | ||||
makeOriginSaveRequest(origin.type, origin.url); | makeOriginSaveRequest(origin.type, origin.url); | ||||
▲ Show 20 Lines • Show All 253 Lines • Show Last 20 Lines |
c'mon