test-model-generators.ts 1.22 KB
Newer Older
Exbrayat Cédric's avatar
Exbrayat Cédric committed
1
2
3
4
5
6
import { Page } from './page';
import { GeneticResourceModel } from './genetic-resource.model';

export function toSinglePage<T>(content: Array<T>): Page<T> {
  return {
    content,
Exbrayat Cédric's avatar
Exbrayat Cédric committed
7
    number: 0,
8
9
    size: 20,
    totalElements: content.length,
10
11
    totalPages: 1,
    maxResults: 10000
Exbrayat Cédric's avatar
Exbrayat Cédric committed
12
13
14
  };
}

15
16
17
18
19
20
export function toSecondPage<T>(content: Array<T>): Page<T> {
  return {
    content,
    number: 1,
    size: 20,
    totalElements: 20 + content.length,
21
22
    totalPages: 2,
    maxResults: 10000
23
24
25
  };
}

Exbrayat Cédric's avatar
Exbrayat Cédric committed
26
27
28
29
30
31
32
33
34
35
export function toGeneticResource(name: string): GeneticResourceModel {
  return {
    identifier: name,
    name,
    description: 'A description of the genetic geneticResource',
    pillarName: 'Plant',
    databaseSource: 'BRC4Env',
    portalURL: 'http://brc4env.fr',
    dataURL: `http://brc4env.fr/${name}`,
    domain: 'Plantae',
36
    taxon: [`${name} taxon1`, `${name} taxon2`],
Exbrayat Cédric's avatar
Exbrayat Cédric committed
37
38
39
40
41
42
43
44
45
46
47
48
49
    family: [`${name} family`],
    genus: [`${name} genus`],
    species: [`${name} species`],
    materialType: ['Specimen'],
    biotopeType: ['Plant host'],
    countryOfOrigin: 'France',
    originLatitude: 45.7542224,
    originLongitude: 4.8298569,
    countryOfCollect: 'France',
    collectLatitude: 45.7542224,
    collectLongitude: 4.8298569
  };
}