@gameroom/kit
Version:
Node kit for the Gameroom API
60 lines (55 loc) • 1.49 kB
JavaScript
const chai = require('chai')
const {
models: { Changelog }
} = require('../../')
const should = chai.should()
let object
describe('Changelog', () => {
describe('Changelog.get()', () => {
it('should get array of changelogs', async () => {
let result, error
try {
result = await Changelog.get()
} catch (err) {
error = err
}
should.not.exist(error)
should.exist(result)
result.should.be.a('array')
object = result[0]
})
})
// describe('Changelog.getAll()', () => {
// it('should get array of all changelogs', async () => {
// let result, error
// try {
// result = await Changelog.getAll()
// } catch(err) {
// error = err
// }
// should.not.exist(error)
// should.exist(result)
// result.should.be.a('array')
// })
// })
describe('Changelog.find()', () => {
it('should find a changelog', async () => {
let result, error
try {
result = await Changelog.find(object)
} catch (err) {
error = err
}
should.not.exist(error)
should.exist(result)
result.should.be.a('object')
object = result
})
})
describe('Changelog keys', () => {
it('should match api and kit keys', async () => {
const raw = await Changelog.schema.adapter.find(Changelog.schema, object.id)
Object.keys(new Changelog()).sort().should.deep.equal(Object.keys(raw).sort())
})
})
})