From 58847871c485be6580bec5729c4fd7fa966d615d Mon Sep 17 00:00:00 2001 From: Sam Schantz Date: Mon, 13 May 2024 11:16:31 -0700 Subject: [PATCH 1/4] adding tests --- strr-web/.env.local | 2 +- .../tests/unit/pages/create-account.spec.ts | 18 ++++++++++++++++++ strr-web/vitest.config.mts | 3 ++- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 strr-web/tests/unit/pages/create-account.spec.ts diff --git a/strr-web/.env.local b/strr-web/.env.local index ae24abf6..b9f55877 100644 --- a/strr-web/.env.local +++ b/strr-web/.env.local @@ -4,7 +4,7 @@ VUE_APP_ADDRESS_COMPLETE_KEY= # vaults web-url VUE_APP_REGISTRY_URL="https://dev.bcros.ca/dashboard" VUE_APP_REGISTRY_HOME_URL="https://dev.bcregistry.gov.bc.ca/" -VUE_APP_AUTH_WEB_URL="https://dev.account.bcregistry.gov.bc.ca/" +VUE_APP_AUTH_WEB_URL="http://localhost:3000" # vaults keycloak VUE_APP_KEYCLOAK_AUTH_URL="https://dev.loginproxy.gov.bc.ca/auth" VUE_APP_KEYCLOAK_REALM="bcregistry" diff --git a/strr-web/tests/unit/pages/create-account.spec.ts b/strr-web/tests/unit/pages/create-account.spec.ts new file mode 100644 index 00000000..dc0657ce --- /dev/null +++ b/strr-web/tests/unit/pages/create-account.spec.ts @@ -0,0 +1,18 @@ +import { expect, describe, test } from 'vitest' +import { VueWrapper, mount } from '@vue/test-utils' +import { mockedI18n } from '@/tests/unit/utils/mockedi18n' +import createAccount from '@/pages/create-account.vue' + +describe('Tests for Account Selection page', () => { + let wrapper: VueWrapper + + beforeEach(() => { + wrapper = mount(createAccount, { global: { plugins: [mockedI18n] } }) + }) + afterEach(() => { wrapper.unmount() }) + + test('Contains all the expected elements', () => { + expect(wrapper.find('[data-cy="create-account-page"]').exists()).toBe(true) + // TODO: TC - add the existing account list if there are accounts? + }) +}) diff --git a/strr-web/vitest.config.mts b/strr-web/vitest.config.mts index f2efc3c1..a73c1670 100644 --- a/strr-web/vitest.config.mts +++ b/strr-web/vitest.config.mts @@ -12,7 +12,8 @@ export default defineVitestConfig({ "enums/*", "interfaces/*", "*.d.ts", - ".nuxt/*" + ".nuxt/*", + "public/" ], reportsDirectory: 'coverage', }, From d0a826c66daa9af1b9f4eeb6e4325b871a757a5b Mon Sep 17 00:00:00 2001 From: Sam Schantz Date: Mon, 13 May 2024 12:55:19 -0700 Subject: [PATCH 2/4] adding fetch from store --- strr-web/pages/create-account.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/strr-web/pages/create-account.vue b/strr-web/pages/create-account.vue index 7271c155..59e27f9f 100644 --- a/strr-web/pages/create-account.vue +++ b/strr-web/pages/create-account.vue @@ -56,6 +56,11 @@ const activeStepIndex: Ref = ref(0) const activeStep: Ref = ref(steps[activeStepIndex.value]) const t = useNuxtApp().$i18n.t +const { userFullName } = useBcrosAccount() + +if (activeStepIndex.value == 0) { + activeStep.value.sections[0].fields[0].content = userFullName; +} const setActiveStep = (newStep: number) => { activeStepIndex.value = newStep From d2dd8e7668eb058a80419a7ba02d35d44e07bce5 Mon Sep 17 00:00:00 2001 From: Sam Schantz Date: Mon, 13 May 2024 12:56:43 -0700 Subject: [PATCH 3/4] adding fetch from store --- strr-web/pages/create-account.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/strr-web/pages/create-account.vue b/strr-web/pages/create-account.vue index 59e27f9f..3b10a390 100644 --- a/strr-web/pages/create-account.vue +++ b/strr-web/pages/create-account.vue @@ -58,8 +58,8 @@ const activeStep: Ref = ref(steps[activeStepIndex.value]) const t = useNuxtApp().$i18n.t const { userFullName } = useBcrosAccount() -if (activeStepIndex.value == 0) { - activeStep.value.sections[0].fields[0].content = userFullName; +if (activeStepIndex.value === 0) { + activeStep.value.sections[0].fields[0].content = userFullName } const setActiveStep = (newStep: number) => { From 2cd58fa6ae12da41cf598c76a2910c8412e32b59 Mon Sep 17 00:00:00 2001 From: Sam Schantz Date: Mon, 13 May 2024 12:57:34 -0700 Subject: [PATCH 4/4] reverting env changes --- strr-web/.env.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strr-web/.env.local b/strr-web/.env.local index b9f55877..ae24abf6 100644 --- a/strr-web/.env.local +++ b/strr-web/.env.local @@ -4,7 +4,7 @@ VUE_APP_ADDRESS_COMPLETE_KEY= # vaults web-url VUE_APP_REGISTRY_URL="https://dev.bcros.ca/dashboard" VUE_APP_REGISTRY_HOME_URL="https://dev.bcregistry.gov.bc.ca/" -VUE_APP_AUTH_WEB_URL="http://localhost:3000" +VUE_APP_AUTH_WEB_URL="https://dev.account.bcregistry.gov.bc.ca/" # vaults keycloak VUE_APP_KEYCLOAK_AUTH_URL="https://dev.loginproxy.gov.bc.ca/auth" VUE_APP_KEYCLOAK_REALM="bcregistry"