CSR-416 Add tests
This commit is contained in:
parent
c648512029
commit
50c2b787e0
1 changed files with 34 additions and 10 deletions
|
|
@ -666,24 +666,48 @@ describe("vehicle-damage.vue", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("hide back button", () => {
|
describe("hide back button", () => {
|
||||||
test.only("if claim registration is delayed => should hide back button", () => {
|
test("if claim registration is delayed => should hide back button", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({
|
||||||
cookieHelper.getFunnelCookie = jest.spyOn(cookieHelper, "getFunnelCookie").mockReturnValue({
|
funnelCookie: {
|
||||||
HasDelayedClaimRegistration: true
|
HasDelayedClaimRegistration: true
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.shouldHideBackButton()).toBe(true);
|
expect(wrapper.vm.shouldHideBackButton).toBe(true);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test.todo("if claim is verified => should hide back button")
|
test("if claim is verified => should hide back button", () => {
|
||||||
});
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({
|
||||||
|
mountOptionsMockData: {
|
||||||
|
router: { navigateAfterSave: jest.fn(), },
|
||||||
|
actionList: [{ actionName: storeActions.GET_PARTS_OR_QUESTIONS, data: {}, },],
|
||||||
|
store: {
|
||||||
|
getters: {
|
||||||
|
vehicle: {},
|
||||||
|
payment: { insuranceCoverage: { isVerified: true } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.shouldHideBackButton).toBe(true);
|
||||||
|
})
|
||||||
|
|
||||||
|
test("if claim isn't verified yet => allow user to go back", () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.shouldHideBackButton).toBeFalsy();
|
||||||
|
})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData }) {
|
function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData, funnelCookie = {} }) {
|
||||||
var pageHeaderWidgetHeaderTextDefault = {};
|
var pageHeaderWidgetHeaderTextDefault = {};
|
||||||
var mountOptionsMockDataDefault = {
|
var mountOptionsMockDataDefault = {
|
||||||
router: {
|
router: {
|
||||||
|
|
@ -740,7 +764,7 @@ function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData }) {
|
||||||
|
|
||||||
settleAllPromises.mockImplementation(() => apiPromise);
|
settleAllPromises.mockImplementation(() => apiPromise);
|
||||||
fetchCmsContentForPage.mockImplementation(() => Promise.resolve());
|
fetchCmsContentForPage.mockImplementation(() => Promise.resolve());
|
||||||
cookieHelper.getFunnelCookie = jest.spyOn(cookieHelper, "getFunnelCookie").mockReturnValue({});
|
cookieHelper.getFunnelCookie = jest.spyOn(cookieHelper, "getFunnelCookie").mockReturnValue(funnelCookie);
|
||||||
|
|
||||||
//Mock damage initialize methods
|
//Mock damage initialize methods
|
||||||
damageLocationQuestion.methods = {
|
damageLocationQuestion.methods = {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue