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", () => {
|
||||
test.only("if claim registration is delayed => should hide back button", () => {
|
||||
test("if claim registration is delayed => should hide back button", () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
cookieHelper.getFunnelCookie = jest.spyOn(cookieHelper, "getFunnelCookie").mockReturnValue({
|
||||
HasDelayedClaimRegistration: true
|
||||
const { wrapper } = setupMocks({
|
||||
funnelCookie: {
|
||||
HasDelayedClaimRegistration: true
|
||||
}
|
||||
});
|
||||
|
||||
// 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 mountOptionsMockDataDefault = {
|
||||
router: {
|
||||
|
|
@ -740,7 +764,7 @@ function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData }) {
|
|||
|
||||
settleAllPromises.mockImplementation(() => apiPromise);
|
||||
fetchCmsContentForPage.mockImplementation(() => Promise.resolve());
|
||||
cookieHelper.getFunnelCookie = jest.spyOn(cookieHelper, "getFunnelCookie").mockReturnValue({});
|
||||
cookieHelper.getFunnelCookie = jest.spyOn(cookieHelper, "getFunnelCookie").mockReturnValue(funnelCookie);
|
||||
|
||||
//Mock damage initialize methods
|
||||
damageLocationQuestion.methods = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue