This repository has been archived by the owner on Oct 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
37 lines (35 loc) · 1.9 KB
/
test.js
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
'use strict'
const tapeWithoutPromise = require('tape')
const addPromiseSupport = require('tape-promise').default
const tape = addPromiseSupport(tapeWithoutPromise)
const isEqual = require('lodash.isequal')
const round = require('lodash.round')
const heritage = require('.')
tape('world-heritage', async (t) => {
const h = await heritage()
t.ok(h.length > 500, 'result count')
const aachen = h.filter((x) => x.id === 3)[0]
t.ok(aachen.category === 'Cultural', 'aachen category')
t.ok(isEqual(aachen.criteria, ['i', 'ii', 'iv', 'vi']), 'aachen criteria')
t.ok(aachen.dates.inscription === 1978, 'aachen dates inscription')
t.ok(isEqual(aachen.dates.other, []), 'aachen dates other')
t.ok(aachen.extension === 0, 'aachen extension')
t.ok(aachen.danger === null, 'aachen danger')
t.ok(aachen.description.historical === null, 'aachen description historical')
t.ok(aachen.description.long.length > 300, 'aachen description long')
t.ok(aachen.description.short.length > 50, 'aachen description short')
t.ok(aachen.justification === null, 'aachen justification')
t.ok(aachen.location === 'State of North Rhine-Westphalia (Nordrhein-Westfalen)', 'aachen location')
t.ok(round(aachen.coordinates.longitude, 3) === 6.084, 'aachen coordinates longitude')
t.ok(round(aachen.coordinates.latitude, 3) === 50.774, 'aachen coordinates latitude')
t.ok(aachen.url === 'https://whc.unesco.org/en/list/3', 'aachen url')
t.ok(aachen.id === 3, 'aachen id')
t.ok(aachen.image === 'https://whc.unesco.org/uploads/sites/site_3.jpg', 'aachen image')
t.ok(isEqual(aachen.countries, { iso: ['de'], names: ['Germany'] }), 'aachen countries')
t.ok(aachen.region === 'Europe and North America', 'aachen region')
t.ok(aachen.revision === 0, 'aachen revision')
t.ok(aachen.site === 'Aachen Cathedral ', 'aachen site')
t.ok(aachen.transBoundary === false, 'aachen transBoundary')
t.ok(aachen.uniqueNumber === 1953, 'aachen uniqueNumber')
t.end()
})