-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added bal meta clefInterop and deprecatedID retrieval in export from …
…postgres to mongo
- Loading branch information
1 parent
f8746ff
commit 68d4107
Showing
2 changed files
with
121 additions
and
11 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import {checkIfDeprecatedIDIsValid} from './format-to-legacy-helpers.js' | ||
|
||
describe('checkIfDeprecatedIDIsValid', () => { | ||
test('should return false for an empty string', () => { | ||
expect(checkIfDeprecatedIDIsValid('')).toBe(false) | ||
expect(checkIfDeprecatedIDIsValid('', true)).toBe(false) | ||
}) | ||
|
||
test('should return false for a null value', () => { | ||
expect(checkIfDeprecatedIDIsValid(null)).toBe(false) | ||
expect(checkIfDeprecatedIDIsValid(null, true)).toBe(false) | ||
}) | ||
|
||
test('should return false for a string with "xxxx" as the street code', () => { | ||
expect(checkIfDeprecatedIDIsValid('31555_xxxx_00001', true)).toBe(false) | ||
expect(checkIfDeprecatedIDIsValid('31555_xxxx')).toBe(false) | ||
}) | ||
|
||
test('should return false for a string not matching the pattern', () => { | ||
expect(checkIfDeprecatedIDIsValid('315_7172_00001', true)).toBe(false) | ||
expect(checkIfDeprecatedIDIsValid('31555_7172a_00001', true)).toBe(false) | ||
expect(checkIfDeprecatedIDIsValid('31555_ilwhc0_000001', true)).toBe(false) | ||
expect(checkIfDeprecatedIDIsValid('31555_ilwhc0_0000a', true)).toBe(false) | ||
expect(checkIfDeprecatedIDIsValid('31555_Ilwhc0_00001', true)).toBe(false) | ||
expect(checkIfDeprecatedIDIsValid('31555_Ilwhc0_00001_bât', true)).toBe(false) | ||
expect(checkIfDeprecatedIDIsValid('31555_Ilwhc0_00001_bât.a', true)).toBe(false) | ||
expect(checkIfDeprecatedIDIsValid('31555_Ilwhc0_00001_bât a', true)).toBe(false) | ||
expect(checkIfDeprecatedIDIsValid('315_7172')).toBe(false) | ||
expect(checkIfDeprecatedIDIsValid('31555_7172a')).toBe(false) | ||
expect(checkIfDeprecatedIDIsValid('31555_Ilwhc0')).toBe(false) | ||
}) | ||
|
||
test('should return false for a string with invalid characters', () => { | ||
expect(checkIfDeprecatedIDIsValid('31555_ilwhc#_00001', true)).toBe(false) | ||
expect(checkIfDeprecatedIDIsValid('31555_ilwhc!_00001', true)).toBe(false) | ||
expect(checkIfDeprecatedIDIsValid('31555_ilwhc#')).toBe(false) | ||
expect(checkIfDeprecatedIDIsValid('31555_ilwhc!')).toBe(false) | ||
}) | ||
|
||
test('should return true for a string matching the pattern', () => { | ||
expect(checkIfDeprecatedIDIsValid('31555_ilwhc0_00001', true)).toBe(true) | ||
expect(checkIfDeprecatedIDIsValid('31555_7172_00001', true)).toBe(true) | ||
expect(checkIfDeprecatedIDIsValid('31555_7172_00001_bis', true)).toBe(true) | ||
expect(checkIfDeprecatedIDIsValid('31555_7172_00001_a1', true)).toBe(true) | ||
expect(checkIfDeprecatedIDIsValid('31555_7172_00001_bis_a1', true)).toBe(true) | ||
expect(checkIfDeprecatedIDIsValid('31555_ilwhc0')).toBe(true) | ||
expect(checkIfDeprecatedIDIsValid('31555_7172')).toBe(true) | ||
}) | ||
}) |