forked from electerious/Ackee
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
51 lines (38 loc) · 1.25 KB
/
server.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
49
50
51
'use strict'
const test = require('ava')
const uuid = require('uuid').v4
const listen = require('test-listen')
const fetch = require('node-fetch')
const server = require('../src/server')
const base = listen(server)
test('return 404', async (t) => {
const url = new URL(`/${ uuid() }`, await base)
const { status } = await fetch(url.href)
t.is(status, 404)
})
test('return production styles', async (t) => {
const url = new URL('/index.css', await base)
const response = await fetch(url.href)
const content = await response.text()
t.is(typeof content, 'string')
t.false(content.includes('sourceMappingURL'))
})
test('return production scripts', async (t) => {
const url = new URL('/index.js', await base)
const response = await fetch(url.href)
const content = await response.text()
t.is(typeof content, 'string')
t.false(content.includes('sourceMappingURL'))
})
test('return tracker', async (t) => {
const url = new URL('/tracker.js', await base)
const response = await fetch(url.href)
const content = await response.text()
t.is(typeof content, 'string')
t.false(content.includes('sourceMappingURL'))
})
test('return favicon', async (t) => {
const url = new URL('/favicon.ico', await base)
const { status } = await fetch(url.href)
t.is(status, 200)
})