2023-09-07 09:39:09 +00:00
|
|
|
import { describe } from "mocha";
|
|
|
|
import chaiAsPromised from "chai-as-promised";
|
|
|
|
import chai from "chai";
|
|
|
|
import { expect} from "chai";
|
|
|
|
import { testDb as db } from "../db.mjs";
|
|
|
|
import Story from "../objects/Story.mjs";
|
|
|
|
chai.use(chaiAsPromised)
|
|
|
|
describe("testing Story object",function(){
|
|
|
|
it("should throw TypeError if .word_count is not an integer",function(){
|
2023-09-14 14:06:17 +00:00
|
|
|
expect(()=>{new Story({word_count:"boo"})}).to.throw(TypeError)
|
2023-09-07 09:39:09 +00:00
|
|
|
})
|
|
|
|
it("should have .word_count if created with valid data, and .word_count should be an integer",function(){
|
|
|
|
const story = new Story({word_count:100})
|
|
|
|
expect(story).to.contain.key('word_count')
|
|
|
|
expect(story.word_count).to.satisfy(Number.isInteger)
|
|
|
|
})
|
|
|
|
})
|