Skip to content

Commit 0ab17a5

Browse files
authored
Merge pull request #134 from DEFRA/feat/df-865-repeater-content-2
feat/df-865: New internal formatter (human v2) to include repeater content
2 parents 59d0336 + ee19f7d commit 0ab17a5

12 files changed

Lines changed: 1987 additions & 45 deletions

File tree

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ sonar.sources=src
2020
sonar.exclusions=**/*.test.*,**/__mocks__/**,**/__stubs__/**
2121
sonar.tests=src,test
2222
sonar.test.inclusions=**/*.test.*,**/__mocks__/**,**/__stubs__/**
23-
sonar.cpd.exclusions=**/*.test.*,**/__mocks__/**,**/__stubs__/**
23+
sonar.cpd.exclusions=**/*.test.*,**/__mocks__/**,**/__stubs__/**,**/formatters/human/v*.js

src/helpers/string-utils.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,17 @@ export function stringHasNonEmptyValue(str) {
1818

1919
return str !== ''
2020
}
21+
22+
/**
23+
* Helper for validating the presence of strings during unit tests
24+
* @param {string} str - string to search within
25+
* @param {number} pos - position to start the search from
26+
* @param {string} findStr - string to be found
27+
*/
28+
export function stringExistsFromPosition(str, pos, findStr) {
29+
const findPos = str.indexOf(findStr, pos)
30+
if (findPos === -1) {
31+
throw new Error(`String not found '${findStr}'`)
32+
}
33+
return findPos + findStr.length
34+
}

0 commit comments

Comments
 (0)