-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #183 from UK-Export-Finance/chore/EMS-653
chore(EMS-653): UI helpers documentation, improve directory structure
- Loading branch information
Showing
47 changed files
with
372 additions
and
86 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...ui/server/helpers/country-support.test.ts → ...ver/helpers/country-support/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import { Country } from '../../../types'; | ||
|
||
/** | ||
* mapCountry | ||
* Map country answer to a simple name string | ||
* @param {Object} Country | ||
* @returns {String} Country name | ||
*/ | ||
const mapCountry = (countryObj: Country) => countryObj.name; | ||
|
||
export default mapCountry; |
6 changes: 6 additions & 0 deletions
6
src/ui/server/helpers/data-content-mappings/map-period-months.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ui/server/helpers/format-currency.test.ts → ...ver/helpers/format-currency/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/ui/server/helpers/format-currency.ts → ...i/server/helpers/format-currency/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...erver/helpers/get-country-by-name.test.ts → ...helpers/get-country-by-name/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 8 additions & 1 deletion
9
src/ui/server/helpers/get-country-by-name.ts → ...rver/helpers/get-country-by-name/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rver/helpers/get-currency-by-code.test.ts → ...elpers/get-currency-by-code/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 8 additions & 1 deletion
9
...ui/server/helpers/get-currency-by-code.ts → ...ver/helpers/get-currency-by-code/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import getLastSubstring from '.'; | ||
|
||
describe('server/helpers/get-last-substring', () => { | ||
it('should return the last sub string', () => { | ||
const mockStr = 'a/b/c'; | ||
|
||
const result = getLastSubstring(mockStr); | ||
|
||
expect(result).toEqual('c'); | ||
}); | ||
|
||
describe('when no string is provided', () => { | ||
it('should return null', () => { | ||
// @ts-ignore | ||
const result = getLastSubstring(); | ||
|
||
expect(result).toEqual(null); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* getLastSubstring | ||
* Get the last sub string in a string | ||
* @param {String} | ||
* @returns {String} Last sub string | ||
*/ | ||
const getLastSubstring = (str: string) => { | ||
if (str) { | ||
return str.substring(str.lastIndexOf('/') + 1); | ||
} | ||
|
||
return null; | ||
}; | ||
|
||
export default getLastSubstring; |
2 changes: 1 addition & 1 deletion
2
...ui/server/helpers/is-change-route.test.ts → ...ver/helpers/is-change-route/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 7 additions & 1 deletion
8
src/ui/server/helpers/is-change-route.ts → ...i/server/helpers/is-change-route/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.