forked from jondashkyle/nanocontent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
48 lines (41 loc) · 1.58 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
38
39
40
41
42
43
44
45
46
47
48
var test = require('ava')
var hypha = require('.')
test('readPageSync works', function (t) {
var page = hypha.readPageSync('example/content/about')
t.is(page.title, 'About')
t.is(page.view, 'custom')
})
test('readPage works', async function (t) {
var page = await hypha.readPage('example/content/about')
t.is(page.title, 'About')
t.is(page.view, 'custom')
})
test('readPageSync and readPage outputs are the same', async function (t) {
var syncPage = hypha.readPageSync('example/content/about')
var asyncPage = await hypha.readPage('example/content/about')
t.deepEqual(syncPage, asyncPage)
})
test('readPage includes image files sizes', function (t) {
var page = hypha.readPageSync('example/content/about')
for (var file in page.files) {
if (page.files[file].type === 'image') {
t.is(page.files[file].width, 316)
t.is(page.files[file].height, 230)
}
}
})
test('readSiteSync works', function (t) {
var site = hypha.readSiteSync('example/content')
t.is(site['/example/content'].title, 'Example')
t.is(site['/example/content/about'].title, 'About')
})
test('readSiteSync and readSite outputs are the same', async function (t) {
var syncSite = hypha.readSiteSync('example/content')
var asyncSite = await hypha.readSite('example/content')
t.deepEqual(syncSite, asyncSite)
})
test('readSiteSync and readSite outputs are the same with parent option', async function (t) {
var syncSite = hypha.readSiteSync('example/content', { parent: true })
var asyncSite = await hypha.readSite('example/content', { parent: true })
t.deepEqual(syncSite, asyncSite)
})