From aff5ca54f14f321aca00765cb7e0f743f2f91542 Mon Sep 17 00:00:00 2001 From: saumyaChaturvedi123 <108388239+saumyaChaturvedi123@users.noreply.github.com> Date: Fri, 7 Apr 2023 15:25:44 +0530 Subject: [PATCH] SSR-361 Navigation to/from provider preference page --- .../service-location/service-location.spec.js | 32 +++++++++++++++++++ src/router/router-constants/routing-table.js | 10 ++++++ 2 files changed, 42 insertions(+) create mode 100644 src/layouts/service-location/service-location.spec.js 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, + }, + + ], + }, ]; };