Skip to content

Commit 5d752e4

Browse files
fix: search by reference number and status (#49)
* fix: search by reference number and status * bump: version
1 parent be093cc commit 5d752e4

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

app/lib/search-validation.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const appRefRegEx = /^vv-[\da-f]{4}-[\da-f]{4}$/i
2-
const validStatus = ['applied', 'withdrawn', 'data inputted', 'claimed', 'check', 'accepted', 'rejected', 'paid']
1+
const appRefRegEx = /^AHWR-[\da-f]{4}-[\da-f]{4}$/i
2+
const validStatus = ['agreed', 'applied', 'withdrawn', 'data inputted', 'claimed', 'check', 'accepted', 'rejected', 'paid', 'not agreed']
33
const sbiRegEx = /^[\0-9]{9}$/i
44

55
module.exports = (searchText) => {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ffc-ahwr-backoffice",
3-
"version": "1.14.1",
3+
"version": "1.14.2",
44
"description": "Back office of the health and welfare of your livestock",
55
"homepage": "https://github.com/DEFRA/ffc-ahwr-backoffice",
66
"main": "app/index.js",

test/data/applications.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"applications": [
44
{
55
"id": "555afd4c-b095-4ce4-b492-800466b53393",
6-
"reference": "VV-555A-FD4C",
6+
"reference": "AHWR-555A-FD4C",
77
"status": { "status": "APPLIED" },
88
"data": {
99
"declaration": true,
@@ -26,7 +26,7 @@
2626
},
2727
{
2828
"id": "555afd4c-b095-4ce4-b492-800466b54493",
29-
"reference": "VV-555A-FD4D",
29+
"reference": "AHWR-555A-FD4D",
3030
"status": { "status": "REJECTED" },
3131
"data": {
3232
"declaration": true,
@@ -49,7 +49,7 @@
4949
},
5050
{
5151
"id": "555afd4c-b095-4ce4-b492-800466b55593",
52-
"reference": "VV-555A-FD5D",
52+
"reference": "AHWR-555A-FD5D",
5353
"status": { "status": "DATA INPUTTED" },
5454
"data": {
5555
"declaration": true,
@@ -72,7 +72,7 @@
7272
},
7373
{
7474
"id": "555afd4c-b095-4ce4-b492-800466b66693",
75-
"reference": "VV-555A-FD6E",
75+
"reference": "AHWR-555A-FD6E",
7676
"status": { "status": "WITHDRAWN" },
7777
"data": {
7878
"declaration": true,
@@ -95,7 +95,7 @@
9595
},
9696
{
9797
"id": "555afd4c-b095-4ce4-b492-800466b66693",
98-
"reference": "VV-666A-FD6E",
98+
"reference": "AHWR-666A-FD6E",
9999
"status": { "status": "ACCEPTED" },
100100
"data": {
101101
"declaration": true,
@@ -118,7 +118,7 @@
118118
},
119119
{
120120
"id": "555afd4c-b095-4ce4-b492-800466b78693",
121-
"reference": "VV-666A-FD7E",
121+
"reference": "AHWR-666A-FD7E",
122122
"status": { "status": "CHECK" },
123123
"data": {
124124
"declaration": true,
@@ -141,7 +141,7 @@
141141
},
142142
{
143143
"id": "555afd4c-b095-4ce4-b492-800466b88893",
144-
"reference": "VV-666A-AB6E",
144+
"reference": "AHWR-666A-AB6E",
145145
"status": { "status": "CLAIMED" },
146146
"data": {
147147
"declaration": true,
@@ -164,7 +164,7 @@
164164
},
165165
{
166166
"id": "555afd4c-b095-4ce4-b492-800466b90993",
167-
"reference": "VV-666A-RG6E",
167+
"reference": "AHWR-666A-RG6E",
168168
"status": { "status": "PAID" },
169169
"data": {
170170
"declaration": true,
@@ -187,7 +187,7 @@
187187
},
188188
{
189189
"id": "555afd4c-b095-4ce4-b492-800466b10993",
190-
"reference": "VV-666A-RG7E",
190+
"reference": "AHWR-666A-RG7E",
191191
"status": { "status": "ACCEPTED" },
192192
"data": {
193193
"declaration": true,

test/data/view-applications.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"applied": {
33
"id": "555afd4c-b095-4ce4-b492-800466b53393",
4-
"reference": "VV-555A-FD4C",
4+
"reference": "AHWR-555A-FD4C",
55
"status": { "status": "APPLIED" },
66
"data": {
77
"declaration": true,
@@ -23,9 +23,9 @@
2323
"updatedAt": "2022-06-06T14:27:51.775Z",
2424
"createdBy": "admin"
2525
},
26-
"notaggreed": {
26+
"notagreed": {
2727
"id": "555afd4c-b095-4ce4-b492-800466b53393",
28-
"reference": "VV-555A-FD4C",
28+
"reference": "AHWR-555A-FD4C",
2929
"status": { "status": "NOT AGREED" },
3030
"data": {
3131
"whichReview": "sheep",
@@ -48,7 +48,7 @@
4848
},
4949
"dataInputted": {
5050
"id": "555afd4c-b095-4ce4-b492-800466b53393",
51-
"reference": "VV-555A-FD4C",
51+
"reference": "AHWR-555A-FD4C",
5252
"status": { "status": "DATA INPUTTED" },
5353
"data": {
5454
"declaration": true,
@@ -72,7 +72,7 @@
7272
},
7373
"claim": {
7474
"id": "555afd4c-b095-4ce4-b492-800466b53393",
75-
"reference": "VV-555A-FD4C",
75+
"reference": "AHWR-555A-FD4C",
7676
"status": { "status": "CLAIMED" },
7777
"data": {
7878
"declaration": true,
@@ -101,7 +101,7 @@
101101
},
102102
"paid": {
103103
"id": "555afd4c-b095-4ce4-b492-800466b53393",
104-
"reference": "VV-555A-FD4C",
104+
"reference": "AHWR-555A-FD4C",
105105
"status": { "status": "ACCEPTED" },
106106
"data": {
107107
"declaration": true,
@@ -119,11 +119,11 @@
119119
"confirmCheckDetails": "yes"
120120
},
121121
"payment": {
122-
"applicationReference": "VV-555A-FD4C",
122+
"applicationReference": "AHWR-555A-FD4C",
123123
"data": {
124124
"value": 400,
125125
"frn": 1102057452,
126-
"invoiceNumber": "VV-F528-5345V001",
126+
"invoiceNumber": "AHWR-F528-5345V001",
127127
"invoiceLines": [{
128128
"description": "G00 - Gross value of claim",
129129
"value": 400

test/integration/narrow/routes/applications.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ describe('Applications test', () => {
148148

149149
test.each([
150150
{ searchDetails: { searchText: '444444444', searchType: 'sbi' }, status: ['APPLIED', 'DATA INPUTTED'] },
151-
{ searchDetails: { searchText: 'VV-555A-FD6E', searchType: 'ref' }, status: ['APPLIED', 'CLAIMED'] },
151+
{ searchDetails: { searchText: 'AHWR-555A-FD6E', searchType: 'ref' }, status: ['APPLIED', 'CLAIMED'] },
152152
{ searchDetails: { searchText: 'applied', searchType: 'status' }, status: 'APPLIED' },
153153
{ searchDetails: { searchText: 'data inputted', searchType: 'status' }, status: 'DATA INPUTTED' },
154154
{ searchDetails: { searchText: 'claimed', searchType: 'status' }, status: 'CLAIMED' },
@@ -181,7 +181,7 @@ describe('Applications test', () => {
181181
test.each([
182182
{ searchDetails: { searchText: '333333333' } },
183183
{ searchDetails: { searchText: '444444443' } },
184-
{ searchDetails: { searchText: 'VV-555A-F5D5' } },
184+
{ searchDetails: { searchText: 'AHWR-555A-F5D5' } },
185185
{ searchDetails: { searchText: '' } },
186186
{ searchDetails: { searchText: null } },
187187
{ searchDetails: { searchText: undefined } }

test/integration/narrow/routes/view-application.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const expectPhaseBanner = require('../../../utils/phase-banner-expect')
33
const applications = require('../../../../app/api/applications')
44
const { administrator } = require('../../../../app/auth/permissions')
55
const viewApplicationData = require('.././../../data/view-applications.json')
6-
const reference = 'VV-555A-FD4C'
6+
const reference = 'AHWR-555A-FD4C'
77

88
jest.mock('../../../../app/api/applications')
99

@@ -78,7 +78,7 @@ describe('View Application test', () => {
7878
expectPhaseBanner.ok($)
7979
})
8080
test('returns 200 application applied', async () => {
81-
applications.getApplication.mockReturnValueOnce(viewApplicationData.notaggreed)
81+
applications.getApplication.mockReturnValueOnce(viewApplicationData.notagreed)
8282
const options = {
8383
method: 'GET',
8484
url,

0 commit comments

Comments
 (0)