From 496bd9574475303f38bfde2306b05612d9fc3067 Mon Sep 17 00:00:00 2001 From: Precious Onyenaucheya Date: Thu, 5 Sep 2024 16:33:25 +0100 Subject: [PATCH] update test --- src/components/address-input/_macro.spec.js | 2 +- src/components/address-input/_test-examples.js | 6 +----- src/components/address-input/autosuggest.address.spec.js | 6 +++--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/components/address-input/_macro.spec.js b/src/components/address-input/_macro.spec.js index e1a894f32b..2c964cae74 100644 --- a/src/components/address-input/_macro.spec.js +++ b/src/components/address-input/_macro.spec.js @@ -6,7 +6,7 @@ import axe from '../../tests/helpers/axe'; import { renderComponent, templateFaker } from '../../tests/helpers/rendering'; import { EXAMPLE_AUTOSUGGEST_ADDRESS_MINIMAL, EXAMPLE_MANUAL_INPUT_FIELDS } from './_test-examples'; -describe('FOR: address-input', () => { +describe('FOR: MACRO: address-input', () => { describe('GIVEN: Params: none', () => { describe('WHEN: All params are at default state', () => { const $ = cheerio.load(renderComponent('address-input', EXAMPLE_AUTOSUGGEST_ADDRESS_MINIMAL)); diff --git a/src/components/address-input/_test-examples.js b/src/components/address-input/_test-examples.js index 741c9beb00..22cf424d0d 100644 --- a/src/components/address-input/_test-examples.js +++ b/src/components/address-input/_test-examples.js @@ -50,7 +50,7 @@ export const EXAMPLE_MANUAL_INPUT_FIELDS = { }, }; -const EXAMPLE_ADDRESS_INPUT = { +export const EXAMPLE_ADDRESS_INPUT_WITH_API = { id: 'address', autocomplete: 'off', label: { @@ -102,10 +102,6 @@ const EXAMPLE_ADDRESS_INPUT = { }, searchButton: 'Search for an address', manualLinkText: 'Manually enter address', -}; - -export const EXAMPLE_ADDRESS_INPUT_WITH_API = { - ...EXAMPLE_ADDRESS_INPUT, APIDomain: '/fake/api', APIDomainBearerToken: 'someToken', externalInitialiser: true, diff --git a/src/components/address-input/autosuggest.address.spec.js b/src/components/address-input/autosuggest.address.spec.js index d074b9a0b9..2448246f7e 100644 --- a/src/components/address-input/autosuggest.address.spec.js +++ b/src/components/address-input/autosuggest.address.spec.js @@ -2,7 +2,7 @@ import { PuppeteerEndpointFaker } from '../../tests/helpers/puppeteer'; import { renderComponent, setTestPage } from '../../tests/helpers/rendering'; import { EXAMPLE_ADDRESS_INPUT_WITH_API } from './_test-examples'; -describe('FOR: address-input', () => { +describe('FOR: SCRIPT: address-input', () => { const apiFaker = new PuppeteerEndpointFaker(EXAMPLE_ADDRESS_INPUT_WITH_API.APIDomain); apiFaker.setOverrides( @@ -121,7 +121,7 @@ describe('FOR: address-input', () => { await apiFaker.reset(); }); describe('GIVEN: the component initializes', () => { - describe('WHEN: the component initializes without options', () => { + describe("WHEN: 'options' is not provided", () => { test('THEN: it checks api status by trying a request', async () => { await setTestPage('/test', renderComponent('address-input', EXAMPLE_ADDRESS_INPUT_WITH_API)); await page.waitForTimeout(50); @@ -219,7 +219,7 @@ describe('FOR: address-input', () => { addressType: 'workplace', }, ], - ])('WHEN: the component initialises with options - %s', (_, searchEndpoint, uprnEndpoint, lang, options) => { + ])("WHEN: 'options' is provided - %s", (_, searchEndpoint, uprnEndpoint, lang, options) => { beforeEach(async () => { apiFaker.setTemporaryOverride(searchEndpoint, { data: {