1
0

Adjust tests for async interface

This commit is contained in:
Bán Dénes 2021-07-15 22:03:03 +02:00
parent 1cb9fdc3c2
commit bc7578199d
3 changed files with 12 additions and 12 deletions

View File

@ -8,8 +8,8 @@ const a = require('./assert')
const kle = require('./kle')
exports.interpret = (raw, logger) => {
let config
let format
let config = raw
let format = 'OBJ'
if (a.type(raw)() != 'object') {
try {
config = yaml.safeLoad(raw)

View File

@ -33,9 +33,9 @@ const cap = s => s.charAt(0).toUpperCase() + s.slice(1)
const test = function(input_path) {
this.timeout(120000)
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 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 (dump) {

View File

@ -54,22 +54,22 @@ const underscore = obj => {
describe('Interface', function() {
it('minimal', function() {
underscore(ergogen.process(minimal)).should.be.false
it('minimal', async function() {
underscore(await ergogen.process(minimal)).should.be.false
})
it('production', function() {
underscore(ergogen.process(full, false)).should.be.false
it('production', async function() {
underscore(await ergogen.process(full, false)).should.be.false
})
it('debug', function() {
underscore(ergogen.process(full, true)).should.be.true
it('debug', async function() {
underscore(await ergogen.process(full, true)).should.be.true
})
it('logging', function() {
it('logging', async function() {
const flag = {value: false}
const logger = msg => { flag.value = true }
ergogen.process(full, false, logger)
await ergogen.process(full, false, logger)
flag.value.should.be.true
})