-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: deal of field prive conum data (#142)
* feat: deal of field prive conum data * refactor: improve is prive readability --------- Co-authored-by: Marc Gavanier <marc.gavanier@gmail.com>
- Loading branch information
1 parent
877d94c
commit 25407b0
Showing
6 changed files
with
53 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,5 +243,8 @@ | |
], | ||
"horaires": { | ||
"osm": "horaires" | ||
}, | ||
"prive": { | ||
"colonne": "prive" | ||
} | ||
} |
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,36 @@ | ||
/* eslint-disable @typescript-eslint/naming-convention, camelcase */ | ||
|
||
import { LieuxMediationNumeriqueMatching, DataSource } from '../../input'; | ||
import { isPrive } from './prive.field'; | ||
|
||
describe('prive field', (): void => { | ||
it('should get prive field from data source using matching information', (): void => { | ||
const matching: LieuxMediationNumeriqueMatching = { | ||
prive: { | ||
colonne: 'prive' | ||
} | ||
} as LieuxMediationNumeriqueMatching; | ||
|
||
const source: DataSource = { | ||
prive: true | ||
}; | ||
|
||
const prive: boolean | undefined = isPrive(source, matching); | ||
|
||
expect(prive).toBe(true); | ||
}); | ||
|
||
it('should not get any prive field', (): void => { | ||
const matching: LieuxMediationNumeriqueMatching = { | ||
prive: { | ||
colonne: 'prive' | ||
} | ||
} as LieuxMediationNumeriqueMatching; | ||
|
||
const source: DataSource = {}; | ||
|
||
const prive: boolean | undefined = isPrive(source, matching); | ||
|
||
expect(prive).toBe(false); | ||
}); | ||
}); |
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,7 @@ | ||
import { LieuxMediationNumeriqueMatching, DataSource, Colonne } from '../../input'; | ||
|
||
const canProcessPrive = (source: DataSource, prive?: Colonne): prive is Colonne => | ||
prive?.colonne != null && source[prive.colonne] != null; | ||
|
||
export const isPrive = (source: DataSource, matching: LieuxMediationNumeriqueMatching): boolean => | ||
canProcessPrive(source, matching.prive) ? Boolean(source[matching.prive.colonne]) : false; |
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