Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
precious-onyenaucheya-ons committed Sep 5, 2024
1 parent 32606bf commit 496bd95
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/address-input/_macro.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
6 changes: 1 addition & 5 deletions src/components/address-input/_test-examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/components/address-input/autosuggest.address.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit 496bd95

Please sign in to comment.