Skip to content

Commit

Permalink
Merge pull request #1248 from onaio/1239-csvJurisdictionNames
Browse files Browse the repository at this point in the history
Remove metadata from jurisdiction name when creating setting payload
  • Loading branch information
moshthepitt authored Sep 4, 2020
2 parents fdebaeb + 00f9bf9 commit 4b8394d
Show file tree
Hide file tree
Showing 6 changed files with 455 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,18 @@ exports[`components/forms/JurisdictionMetadata renders correctly: JurisdictionMe
type="file"
/>
`;

exports[`uploads form uploads a csv file correctly, makes correct calls: file input field 1`] = `
<input
accept=".csv"
className="form-control"
data-testid="file"
disabled={false}
id="file"
name="csv file"
onBlur={[Function]}
onChange={[Function]}
onClick={[Function]}
type="file"
/>
`;
323 changes: 323 additions & 0 deletions src/components/forms/JurisdictionMetadata/tests/fixtures/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,323 @@
export const body = {
settingConfigurations: [
{
identifier: 'jurisdiction_metadata-risk',
settings: [
{
description: 'Jurisdiction Metadata for test1 id 79b139c-3a20-4656-b684-d2d9ed83c94e',
key: '79b139c-3a20-4656-b684-d2d9ed83c94e',
label: 'test1',
value: '80',
},
{
description: 'Jurisdiction Metadata for test2 id 02ebbc84-5e29-4cd5-9b79-c594058923e9',
key: '02ebbc84-5e29-4cd5-9b79-c594058923e9',
label: 'test2',
value: '70',
},
{
description: 'Jurisdiction Metadata for test1 id 79b139c-3a20-4656-b684-d2d9ed83c94e',
key: '79b139c-3a20-4656-b684-d2d9ed83c94e',
label: 'test1',
value: '80',
},
{
description: 'Jurisdiction Metadata for test2 id 02ebbc84-5e29-4cd5-9b79-c594058923e9',
key: '02ebbc84-5e29-4cd5-9b79-c594058923e9',
label: 'test2',
value: '70',
},
{
description: 'Jurisdiction Metadata for test1 id 79b139c-3a20-4656-b684-d2d9ed83c94e',
key: '79b139c-3a20-4656-b684-d2d9ed83c94e',
label: 'test1',
value: '80',
},
{
description: 'Jurisdiction Metadata for test2 id 02ebbc84-5e29-4cd5-9b79-c594058923e9',
key: '02ebbc84-5e29-4cd5-9b79-c594058923e9',
label: 'test2',
value: '70',
},
{
description: 'Jurisdiction Metadata for test1 id 79b139c-3a20-4656-b684-d2d9ed83c94e',
key: '79b139c-3a20-4656-b684-d2d9ed83c94e',
label: 'test1',
value: '80',
},
{
description: 'Jurisdiction Metadata for test2 id 02ebbc84-5e29-4cd5-9b79-c594058923e9',
key: '02ebbc84-5e29-4cd5-9b79-c594058923e9',
label: 'test2',
value: '70',
},
{
description: 'Jurisdiction Metadata for test1 id 79b139c-3a20-4656-b684-d2d9ed83c94e',
key: '79b139c-3a20-4656-b684-d2d9ed83c94e',
label: 'test1',
value: '80',
},
{
description: 'Jurisdiction Metadata for test2 id 02ebbc84-5e29-4cd5-9b79-c594058923e9',
key: '02ebbc84-5e29-4cd5-9b79-c594058923e9',
label: 'test2',
value: '70',
},
{
description: 'Jurisdiction Metadata for test1 id 79b139c-3a20-4656-b684-d2d9ed83c94e',
key: '79b139c-3a20-4656-b684-d2d9ed83c94e',
label: 'test1',
value: '80',
},
{
description: 'Jurisdiction Metadata for test2 id 02ebbc84-5e29-4cd5-9b79-c594058923e9',
key: '02ebbc84-5e29-4cd5-9b79-c594058923e9',
label: 'test2',
value: '70',
},
{
description:
'Jurisdiction Metadata for SKY LOCATION (ONGWEDIVA) id ace82b81-1e64-425b-9264-315e9b00ef25',
key: 'ace82b81-1e64-425b-9264-315e9b00ef25',
label: 'SKY LOCATION (ONGWEDIVA)',
value: '40',
},
{
description: 'Jurisdiction Metadata for Nyaluwiro id 2980',
key: '2980',
label: 'Nyaluwiro',
value: '55',
},
{
description: 'Jurisdiction Metadata for KSB_25 id 3087',
key: '3087',
label: 'KSB_25',
value: '',
},
{
description: 'Jurisdiction Metadata for NYL_4 id 3122',
key: '3122',
label: 'NYL_4',
value: '',
},
{
description: 'Jurisdiction Metadata for NYL_5 id 3123',
key: '3123',
label: 'NYL_5',
value: '',
},
{
description: 'Jurisdiction Metadata for NYL_1 id 3139',
key: '3139',
label: 'NYL_1',
value: '',
},
{
description: 'Jurisdiction Metadata for NYL_2 id 3140',
key: '3140',
label: 'NYL_2',
value: '',
},
{
description: 'Jurisdiction Metadata for NYL_9 id 3210',
key: '3210',
label: 'NYL_9',
value: '',
},
{
description: 'Jurisdiction Metadata for NYL_10 id 3212',
key: '3212',
label: 'NYL_10',
value: '',
},
{
description: 'Jurisdiction Metadata for CMS_6 id 3093',
key: '3093',
label: 'CMS_6',
value: '',
},
{
description: 'Jurisdiction Metadata for CMS_16 id 3517',
key: '3517',
label: 'CMS_16',
value: '',
},
{
description: 'Jurisdiction Metadata for MZU_444 id 3928',
key: '3928',
label: 'MZU_444',
value: '',
},
{
description: 'Jurisdiction Metadata for Lusaka id 2942',
key: '2942',
label: 'Lusaka',
value: '66',
},
{
description: 'Jurisdiction Metadata for Mtendere id 3019',
key: '3019',
label: 'Mtendere',
value: '',
},
{
description: 'Jurisdiction Metadata for ZMB_309 id 3460',
key: '3460',
label: 'ZMB_309',
value: '',
},
{
description: 'Jurisdiction Metadata for CNB_419a id 3372',
key: '3372',
label: 'CNB_419a',
value: '',
},
{
description: 'Jurisdiction Metadata for ZMB_44 id 3703',
key: '3703',
label: 'ZMB_44',
value: '',
},
{
description: 'Jurisdiction Metadata for ZMB_298 id 3704',
key: '3704',
label: 'ZMB_298',
value: '',
},
{
description: 'Jurisdiction Metadata for ZMB_294 id 3705',
key: '3705',
label: 'ZMB_294',
value: '',
},
{
description: 'Jurisdiction Metadata for ZMB_41 id 3706',
key: '3706',
label: 'ZMB_41',
value: '',
},
{
description: 'Jurisdiction Metadata for ZMB_300 id 3708',
key: '3708',
label: 'ZMB_300',
value: '',
},
{
description: 'Jurisdiction Metadata for ZMB_297 id 3717',
key: '3717',
label: 'ZMB_297',
value: '',
},
{
description: 'Jurisdiction Metadata for ZMB_48 id 3718',
key: '3718',
label: 'ZMB_48',
value: '',
},
{
description: 'Jurisdiction Metadata for ZMB_58 id 3719',
key: '3719',
label: 'ZMB_58',
value: '',
},
{
description: 'Jurisdiction Metadata for ZMB_671 id 3405',
key: '3405',
label: 'ZMB_671',
value: '',
},
{
description: 'Jurisdiction Metadata for NVI_439 id 3377',
key: '3377',
label: 'NVI_439',
value: '',
},
{
description: 'Jurisdiction Metadata for test1 id 79b139c-3a20-4656-b684-d2d9ed83c94e',
key: '79b139c-3a20-4656-b684-d2d9ed83c94e',
label: 'test1',
value: '80',
},
{
description: 'Jurisdiction Metadata for test2 id 02ebbc84-5e29-4cd5-9b79-c594058923e9',
key: '02ebbc84-5e29-4cd5-9b79-c594058923e9',
label: 'test2',
value: '70',
},
{
description: 'Jurisdiction Metadata for test1 id 79b139c-3a20-4656-b684-d2d9ed83c94e',
key: '79b139c-3a20-4656-b684-d2d9ed83c94e',
label: 'test1',
value: '80',
},
{
description: 'Jurisdiction Metadata for test2 id 02ebbc84-5e29-4cd5-9b79-c594058923e9',
key: '02ebbc84-5e29-4cd5-9b79-c594058923e9',
label: 'test2',
value: '70',
},
{
description: 'Jurisdiction Metadata for test1 id 79b139c-3a20-4656-b684-d2d9ed83c94e',
key: '79b139c-3a20-4656-b684-d2d9ed83c94e',
label: 'test1',
value: '80',
},
{
description: 'Jurisdiction Metadata for test2 id 02ebbc84-5e29-4cd5-9b79-c594058923e9',
key: '02ebbc84-5e29-4cd5-9b79-c594058923e9',
label: 'test2',
value: '70',
},
{
description: 'Jurisdiction Metadata for test1 id 79b139c-3a20-4656-b684-d2d9ed83c94e',
key: '79b139c-3a20-4656-b684-d2d9ed83c94e',
label: 'test1',
value: '80',
},
{
description: 'Jurisdiction Metadata for test2 id 02ebbc84-5e29-4cd5-9b79-c594058923e9',
key: '02ebbc84-5e29-4cd5-9b79-c594058923e9',
label: 'test2',
value: '70',
},
{
description: 'Jurisdiction Metadata for test1 id 79b139c-3a20-4656-b684-d2d9ed83c94e',
key: '79b139c-3a20-4656-b684-d2d9ed83c94e',
label: 'test1',
value: '80',
},
{
description: 'Jurisdiction Metadata for test2 id 02ebbc84-5e29-4cd5-9b79-c594058923e9',
key: '02ebbc84-5e29-4cd5-9b79-c594058923e9',
label: 'test2',
value: '70',
},
{
description: 'Jurisdiction Metadata for test1 id 79b139c-3a20-4656-b684-d2d9ed83c94e',
key: '79b139c-3a20-4656-b684-d2d9ed83c94e',
label: 'test1',
value: '80',
},
{
description: 'Jurisdiction Metadata for test2 id 02ebbc84-5e29-4cd5-9b79-c594058923e9',
key: '02ebbc84-5e29-4cd5-9b79-c594058923e9',
label: 'test2',
value: '70',
},
{
description: 'Jurisdiction Metadata for test1 id 79b139c-3a20-4656-b684-d2d9ed83c94e',
key: '79b139c-3a20-4656-b684-d2d9ed83c94e',
label: 'test1',
value: '80',
},
{
description: 'Jurisdiction Metadata for test2 id 02ebbc84-5e29-4cd5-9b79-c594058923e9',
key: '02ebbc84-5e29-4cd5-9b79-c594058923e9',
label: 'test2',
value: '70',
},
],
type: 'SettingConfiguration',
},
],
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
jurisdiction_id,jurisdiction_name,risk
79b139c-3a20-4656-b684-d2d9ed83c94e,test1,80
02ebbc84-5e29-4cd5-9b79-c594058923e9,test2,70
79b139c-3a20-4656-b684-d2d9ed83c94e,test1,80
02ebbc84-5e29-4cd5-9b79-c594058923e9,test2,70
79b139c-3a20-4656-b684-d2d9ed83c94e,test1,80
02ebbc84-5e29-4cd5-9b79-c594058923e9,test2,70
79b139c-3a20-4656-b684-d2d9ed83c94e,test1,80
02ebbc84-5e29-4cd5-9b79-c594058923e9,test2,70
79b139c-3a20-4656-b684-d2d9ed83c94e,test1,80
02ebbc84-5e29-4cd5-9b79-c594058923e9,test2,70
79b139c-3a20-4656-b684-d2d9ed83c94e,test1,80
02ebbc84-5e29-4cd5-9b79-c594058923e9,test2,70
ace82b81-1e64-425b-9264-315e9b00ef25,SKY LOCATION (ONGWEDIVA),40
2980,Nyaluwiro,55
3087,KSB_25,
3122,NYL_4,
3123,NYL_5,
3139,NYL_1,
3140,NYL_2,
3210,NYL_9,
3212,NYL_10,
3093,CMS_6,
3517,CMS_16,
3928,MZU_444,
2942,Lusaka,66
3019,Mtendere,
3460,ZMB_309,
3372,CNB_419a,
3703,ZMB_44,
3704,ZMB_298,
3705,ZMB_294,
3706,ZMB_41,
3708,ZMB_300,
3717,ZMB_297,
3718,ZMB_48,
3719,ZMB_58,
3405,ZMB_671,
3377,NVI_439,
79b139c-3a20-4656-b684-d2d9ed83c94e,test1,80
02ebbc84-5e29-4cd5-9b79-c594058923e9,test2,70
79b139c-3a20-4656-b684-d2d9ed83c94e,test1,80
02ebbc84-5e29-4cd5-9b79-c594058923e9,test2,70
79b139c-3a20-4656-b684-d2d9ed83c94e,test1,80
02ebbc84-5e29-4cd5-9b79-c594058923e9,test2,70
79b139c-3a20-4656-b684-d2d9ed83c94e,test1,80
02ebbc84-5e29-4cd5-9b79-c594058923e9,test2,70
79b139c-3a20-4656-b684-d2d9ed83c94e,test1,80
02ebbc84-5e29-4cd5-9b79-c594058923e9,test2,70
79b139c-3a20-4656-b684-d2d9ed83c94e,test1,80
02ebbc84-5e29-4cd5-9b79-c594058923e9,test2,70
79b139c-3a20-4656-b684-d2d9ed83c94e,test1,80
02ebbc84-5e29-4cd5-9b79-c594058923e9,test2,70
Loading

0 comments on commit 4b8394d

Please sign in to comment.