diff --git a/src/layouts/service-location/service-location.spec.js b/src/layouts/service-location/service-location.spec.js new file mode 100644 index 00000000..7ec04948 --- /dev/null +++ b/src/layouts/service-location/service-location.spec.js @@ -0,0 +1,32 @@ +import { shallowMount } from "@vue/test-utils"; +import { getMountOptions } from "@/helpers/unit-test-helper.js"; +import serviceLocationModal from "@/layouts/service-location/service-location.vue"; + +describe("navigation", () => { + test("if the back button is clicked, navigate back", async () => { + // Arrange + + const { wrapper } = setupMocks({ + }); + + // Act + await wrapper.vm.backButtonAction(); + + // Assert + expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + }); +}); + + +function setupMocks() +{ + const wrapper = shallowMount( + serviceLocationModal, + getMountOptions({ + router: { + navigate: jest.fn(), + }, + }) + ); + return { wrapper }; +} \ No newline at end of file diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index ecc9a95a..ef72bec4 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -440,6 +440,16 @@ const routingTable = function(store) { }, ], }, + { + issPageValue: issPageValues.SERVICE_LOCATION, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK, + destinationIssPageValue: issPageValues.PROVIDER_PREFERENCE, + }, + + ], + }, ]; };