-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.js
More file actions
27 lines (24 loc) · 947 Bytes
/
test.js
File metadata and controls
27 lines (24 loc) · 947 Bytes
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
const { describe, it } = require('kocha')
const { execSync } = require('child_process')
const { existsSync, readFileSync } = require('fs')
const { join } = require('path')
const assert = require('assert')
describe('langsheet', () => {
it('builds html site', () => {
execSync('rm -rf example/build')
execSync('node ../index.js build', { cwd: join(__dirname, 'example') })
assert(existsSync('./example/build/index.html'))
})
it('builds same html', () => {
execSync('rm -rf example/build')
execSync('node ../index.js build', { cwd: join(__dirname, 'example') })
const htmlStr = readFileSync('./example/build/index.html', 'utf-8')
const builtHtml = readFileSync('./test.html', 'utf-8')
assert(htmlStr === builtHtml)
})
it('throws if the source option not specified', () => {
assert.throws(() => {
execSync('node ../index.js build', { cwd: join(__dirname, 'example-fail') })
}, Error)
})
})