Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not trim frn #100

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/helpers/build-query-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const buildQueryUrl = (path, schemeId, year, prn, frn, revenueOrCapital) => {
if (prn) {
url += `&prn=${prn}`
}
if (frn && frn.trim() !== '') {
if (frn) {
url += `&frn=${frn}`
}
if (revenueOrCapital && revenueOrCapital.trim() !== '') {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ffc-pay-web",
"version": "1.20.14",
"version": "1.20.15",
"description": "FFC payment management service",
"homepage": "https://github.com/DEFRA/ffc-pay-web",
"main": "app/index.js",
Expand Down
7 changes: 3 additions & 4 deletions test/unit/helpers/build-query-url.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('build query URL', () => {
expect(result).toBe('/endpoint?schemeId=123&year=2024')
})

test('should include frn if it is not empty or just whitespace', () => {
test('should include frn if it is not empty', () => {
const path = '/endpoint'
const schemeId = '123'
const year = '2024'
Expand All @@ -18,12 +18,11 @@ describe('build query URL', () => {
expect(result).toBe('/endpoint?schemeId=123&year=2024&frn=456789')
})

test('should not include frn if it is empty or just whitespace', () => {
test('should not include frn if it is undefined', () => {
const path = '/endpoint'
const schemeId = '123'
const year = '2024'
const frn = ' ' // Just whitespace
const result = buildQueryUrl(path, schemeId, year, undefined, frn)
const result = buildQueryUrl(path, schemeId, year, undefined, undefined)
expect(result).toBe('/endpoint?schemeId=123&year=2024')
})

Expand Down