Commit 70d3594
fix: ENG-3901 Adds additional postcode validation (#437)
[ENG-3901]
On both RND 2025 and 2026 we found there's an inconsistency between the
regex used by our storybook's PostcodeLookup component, and the backend
of serverless-giftaid.
We found that the backend was stricter than storybook in its validation
of the outcode (the first half of a postcode) - the postcode `cro 7tp`
was being allowed by the frontend, but rejected by the backend.
The goal here is to make the FE & BE* are stick to the same regex rule.
*(the backend itself doesn't validate, it defers to a function in
data-models. So really we're matching that.)
There's a few tests updated and removed: ones that disallowed not having
a space, or not using capital letters. The backend/data-models
normalises what it's given, so postcodes like bn16aa will get
transformed into BN1 6AA.
To test it works, we should NOT be able to use the above postcode in
either form (the main page, or the /update page)
Last point: I did this a year ago when I had an IDE rule that strips
whitespace. While I don't have that rule enabled anymore, I do still
want to keep the many whitespace removal changes here. A noisier diff,
but it is correct as that is errant whitespace and it shouldn't be here.
I will die on this hill
[ENG-3901]:
https://comicrelief.atlassian.net/browse/ENG-3901?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
---------
Co-authored-by: Krupa Pammi <k.pammi@comicrelief.com>1 parent 5dee113 commit 70d3594
9 files changed
Lines changed: 143 additions & 134 deletions
File tree
- playwright-local/tests
- submit
- update
- playwright-staging/tests
- submit
- update
- src/pages/GiftAid
- SubmitForm
- UpdateForm
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | | - | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
39 | | - | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
51 | | - | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
55 | | - | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
61 | | - | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
| |||
0 commit comments