Skip to content

Commit ada4ea5

Browse files
committed
lint and wiremock change
1 parent 79dc595 commit ada4ea5

2 files changed

Lines changed: 50 additions & 37 deletions

File tree

test/integration/authoritative_data.playwright.test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import { test, expect } from '@playwright/test'
22

33
const resetWiremock = async () => {
4-
await fetch('http://localhost:8001/__admin/mappings/reset', {
4+
const response = await fetch('http://localhost:8001/__admin/mappings/reset', {
55
method: 'POST'
66
})
7+
if (!response.ok) {
8+
throw new Error(`Failed to reset WireMock mappings: ${response.status} ${await response.text()}`)
9+
}
710
}
811

912
test.beforeEach(async () => {
Lines changed: 46 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,66 @@
11
import { test, expect } from '@playwright/test'
22

33
const resetWiremock = async () => {
4-
await fetch('http://localhost:8001/__admin/mappings/reset', {
4+
const response = await fetch('http://localhost:8001/__admin/mappings/reset', {
55
method: 'POST'
66
})
7+
if (!response.ok) {
8+
throw new Error(`Failed to reset WireMock mappings: ${response.status} ${await response.text()}`)
9+
}
710
}
811

912
const addWiremockStub = async (stub) => {
10-
await fetch('http://localhost:8001/__admin/mappings', {
13+
const response = await fetch('http://localhost:8001/__admin/mappings', {
1114
method: 'POST',
1215
headers: { 'Content-Type': 'application/json' },
1316
body: JSON.stringify(stub)
1417
})
18+
if (!response.ok) {
19+
throw new Error(`Failed to add WireMock stub: ${response.status} ${await response.text()}`)
20+
}
1521
}
1622

17-
test.beforeEach(async () => {
18-
await resetWiremock()
19-
})
23+
test.describe('Planning group', () => {
24+
test.describe.configure({ mode: 'serial' })
2025

21-
test('An LPA that is a member of a planning group shows the group membership banner on the overview page', async ({ page }) => {
22-
// Stub the local-planning-group entity endpoint to return a group containing local-authority:SLF
23-
await addWiremockStub({
24-
priority: 1,
25-
request: {
26-
method: 'GET',
27-
urlPattern: '/entity.json.*prefix=local-planning-group.*'
28-
},
29-
response: {
30-
status: 200,
31-
jsonBody: {
32-
entities: [
33-
{
34-
entity: 9000001,
35-
name: 'South London Joint Planning Group',
36-
prefix: 'local-planning-group',
37-
reference: 'south-london-joint',
38-
'organisation-entity': 9000001,
39-
organisations: 'local-authority:SLF;local-authority:LBH',
40-
'end-date': ''
41-
}
42-
],
43-
count: 1
44-
}
45-
}
26+
test.beforeEach(async () => {
27+
await resetWiremock()
4628
})
4729

48-
// Navigate to the LPA overview for SLF
49-
await page.goto('/organisations/local-authority:SLF')
30+
test('An LPA that is a member of a planning group shows the group membership banner on the overview page', async ({ page }) => {
31+
// Stub the local-planning-group entity endpoint to return a group containing local-authority:SLF
32+
await addWiremockStub({
33+
priority: 1,
34+
request: {
35+
method: 'GET',
36+
urlPattern: '/entity.json.*prefix=local-planning-group.*'
37+
},
38+
response: {
39+
status: 200,
40+
jsonBody: {
41+
entities: [
42+
{
43+
entity: 9000001,
44+
name: 'South London Joint Planning Group',
45+
prefix: 'local-planning-group',
46+
reference: 'south-london-joint',
47+
'organisation-entity': 9000001,
48+
organisations: 'local-authority:SLF;local-authority:LBH',
49+
'end-date': ''
50+
}
51+
],
52+
count: 1
53+
}
54+
}
55+
})
5056

51-
// The Group Membership banner should be visible
52-
await expect(page.getByText('Group Membership')).toBeVisible()
57+
// Navigate to the LPA overview for SLF
58+
await page.goto('/organisations/local-authority:SLF')
5359

54-
// The planning group name should appear as a link
55-
await expect(page.getByRole('link', { name: 'South London Joint Planning Group' })).toBeVisible()
60+
// The Group Membership banner should be visible
61+
await expect(page.getByText('Group Membership')).toBeVisible()
62+
63+
// The planning group name should appear as a link
64+
await expect(page.getByRole('link', { name: 'South London Joint Planning Group' })).toBeVisible()
65+
})
5666
})

0 commit comments

Comments
 (0)