Skip to content

Commit 428646e

Browse files
author
Cache Hamm
committed
Fact:Dynamic/Constant test coverage
1 parent 1a26761 commit 428646e

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

test/fact.test.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
import { Fact } from '../src/index'
44

55
describe('Fact', () => {
6+
function subject (id, definition, options) {
7+
return new Fact(id, definition, options)
8+
}
69
describe('Fact::constructor', () => {
7-
function subject (id, definition, options) {
8-
return new Fact(id, definition, options)
9-
}
10-
1110
it('works for constant facts', () => {
1211
let fact = subject('factId', 10)
1312
expect(fact.id).to.equal('factId')
@@ -36,4 +35,18 @@ describe('Fact', () => {
3635
})
3736
})
3837
})
38+
39+
describe('Fact::types', () => {
40+
it('initializes facts with method values as dynamic', () => {
41+
let fact = subject('factId', () => {})
42+
expect(fact.type).to.equal(Fact.DYNAMIC)
43+
expect(fact.isDynamic()).to.be.true()
44+
})
45+
46+
it('initializes facts with non-methods as constant', () => {
47+
let fact = subject('factId', 2)
48+
expect(fact.type).to.equal(Fact.CONSTANT)
49+
expect(fact.isConstant()).to.be.true()
50+
})
51+
})
3952
})

0 commit comments

Comments
 (0)