uci-mqtt/test/amodule.test.js

50 lines
916 B
JavaScript
Raw Permalink Normal View History

2018-04-05 15:50:39 -07:00
import aClass from '../src'
import chai from 'chai'
import chaiAsPromised from 'chai-as-promised'
2017-01-11 15:11:34 -08:00
2018-04-05 15:50:39 -07:00
chai.use(chaiAsPromised)
const expect = chai.expect
2017-01-16 17:05:24 -08:00
describe(
2018-04-05 15:50:39 -07:00
'Testing ',
function () {
hooks()
sometests()
someothertests()
})
2017-01-11 15:11:34 -08:00
//****************** TESTS **********************
function sometests() {
2018-04-05 15:50:39 -07:00
it('==> test something', async function () {
2017-01-11 15:11:34 -08:00
2018-04-05 15:50:39 -07:00
let result = await someasyncfunction()
expect(result, 'test failed').to.equal('expectedresult')
2017-01-11 15:11:34 -08:00
2018-04-05 15:50:39 -07:00
})
}
function someothertests() {
2018-04-05 15:50:39 -07:00
it('==> test something', async function () {
2018-04-05 15:50:39 -07:00
let result = await someasyncfunction()
expect(result, 'test failed').to.equal('expectedresult')
2018-04-05 15:50:39 -07:00
})
}
function hooks() {
2018-04-05 15:50:39 -07:00
before(async() => {
await someasyncfunctiontodobefore()
})
2018-04-05 15:50:39 -07:00
beforeEach(async() => {
await someasyncfunctiontodobeforeeachtest()
})
2018-04-05 15:50:39 -07:00
after(async() => {
await someasyncfunctiontodoaftereeachtest()
})
}