|
3 | 3 | import { Fact } from '../src/index' |
4 | 4 |
|
5 | 5 | describe('Fact', () => { |
| 6 | + function subject (id, definition, options) { |
| 7 | + return new Fact(id, definition, options) |
| 8 | + } |
6 | 9 | describe('Fact::constructor', () => { |
7 | | - function subject (id, definition, options) { |
8 | | - return new Fact(id, definition, options) |
9 | | - } |
10 | | - |
11 | 10 | it('works for constant facts', () => { |
12 | 11 | let fact = subject('factId', 10) |
13 | 12 | expect(fact.id).to.equal('factId') |
@@ -36,4 +35,18 @@ describe('Fact', () => { |
36 | 35 | }) |
37 | 36 | }) |
38 | 37 | }) |
| 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 | + }) |
39 | 52 | }) |
0 commit comments