Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { StandarizedPublication } from '@/types/publications';
import { mapStandarizedPublicationsToCSVString } from './mapStandarizedPublicationsToCSVString';
const CASES: [StandarizedPublication[], string][] = [
[[], ''],
[
[
{
pubmedId: '',
year: '',
journal: '',
authors: '',
title: '',
modelNames: '',
elementsIds: '',
},
],
'"","","","","","",""',
],
[
[
{
authors: 'authors',
title: 'title',
journal: 'journal',
pubmedId: 'pubmedId',
modelNames: 'modelNames',
elementsIds: 'elementsIds',
year: 'year',
},
],
'"pubmedId","title","authors","journal","year","elementsIds","modelNames"',
],
];
describe('mapStandarizedPublicationsToCSVString - util', () => {
it.each(CASES)('should return valid string', (input, result) => {
expect(mapStandarizedPublicationsToCSVString(input)).toBe(result);
});
});