Adjust tests for async interface
This commit is contained in:
parent
1cb9fdc3c2
commit
bc7578199d
3 changed files with 12 additions and 12 deletions
|
@ -8,8 +8,8 @@ const a = require('./assert')
|
||||||
const kle = require('./kle')
|
const kle = require('./kle')
|
||||||
|
|
||||||
exports.interpret = (raw, logger) => {
|
exports.interpret = (raw, logger) => {
|
||||||
let config
|
let config = raw
|
||||||
let format
|
let format = 'OBJ'
|
||||||
if (a.type(raw)() != 'object') {
|
if (a.type(raw)() != 'object') {
|
||||||
try {
|
try {
|
||||||
config = yaml.safeLoad(raw)
|
config = yaml.safeLoad(raw)
|
||||||
|
|
|
@ -33,9 +33,9 @@ const cap = s => s.charAt(0).toUpperCase() + s.slice(1)
|
||||||
const test = function(input_path) {
|
const test = function(input_path) {
|
||||||
this.timeout(120000)
|
this.timeout(120000)
|
||||||
title = path.basename(input_path, '.yaml').split('_').join(' ')
|
title = path.basename(input_path, '.yaml').split('_').join(' ')
|
||||||
it(title, function() {
|
it(title, async function() {
|
||||||
const input = yaml.load(fs.readFileSync(input_path).toString())
|
const input = yaml.load(fs.readFileSync(input_path).toString())
|
||||||
const actual = ergogen.process(input, true)
|
const actual = await ergogen.process(input, true)
|
||||||
|
|
||||||
// if we're just creating the reference, we can dump the current output
|
// if we're just creating the reference, we can dump the current output
|
||||||
if (dump) {
|
if (dump) {
|
||||||
|
|
|
@ -54,22 +54,22 @@ const underscore = obj => {
|
||||||
|
|
||||||
describe('Interface', function() {
|
describe('Interface', function() {
|
||||||
|
|
||||||
it('minimal', function() {
|
it('minimal', async function() {
|
||||||
underscore(ergogen.process(minimal)).should.be.false
|
underscore(await ergogen.process(minimal)).should.be.false
|
||||||
})
|
})
|
||||||
|
|
||||||
it('production', function() {
|
it('production', async function() {
|
||||||
underscore(ergogen.process(full, false)).should.be.false
|
underscore(await ergogen.process(full, false)).should.be.false
|
||||||
})
|
})
|
||||||
|
|
||||||
it('debug', function() {
|
it('debug', async function() {
|
||||||
underscore(ergogen.process(full, true)).should.be.true
|
underscore(await ergogen.process(full, true)).should.be.true
|
||||||
})
|
})
|
||||||
|
|
||||||
it('logging', function() {
|
it('logging', async function() {
|
||||||
const flag = {value: false}
|
const flag = {value: false}
|
||||||
const logger = msg => { flag.value = true }
|
const logger = msg => { flag.value = true }
|
||||||
ergogen.process(full, false, logger)
|
await ergogen.process(full, false, logger)
|
||||||
flag.value.should.be.true
|
flag.value.should.be.true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue