Skip to content

Commit 4a57c09

Browse files
author
daniel.gomez
committed
Added Tests
1 parent f217437 commit 4a57c09

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"babel-preset-es2015": "^6.6.0",
4040
"babel-preset-react": "^6.5.0",
4141
"babel-preset-stage-0": "^6.5.0",
42+
"chai": "^3.5.0",
4243
"mocha": "^2.5.3"
4344
}
4445
}

test/createFactory.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,44 @@
11
import { BootstrapFactory } from '../src/index';
2+
import { expect } from 'chai';
23

34

45
describe("Factory creation", function() {
56
it("User requests an edit factory", function(done) {
7+
8+
let correctConfig = {
9+
'string': 'TextBox',
10+
'array': 'ArrayContainer',
11+
'datetime': 'DateTimePicker',
12+
'time': 'DateTimePicker',
13+
'date': 'DateTimePicker',
14+
'int' : 'TextBox',
15+
'float': 'TextBox',
16+
'bool': 'Checkbox',
17+
'group': 'FieldGroup'
18+
};
19+
20+
let factory = BootstrapFactory.createComponentFactory("edit");
21+
22+
expect(factory.defaultFieldComponents).to.be.deep.equal(correctConfig);
623
done()
724
})
825

926
it("User requests an details factory", function(done) {
27+
let correctConfig = {
28+
'string': 'Static',
29+
'array': 'ArrayContainer',
30+
'datetime': 'Static',
31+
'time': 'Static',
32+
'date': 'Static',
33+
'int': 'Static',
34+
'float': 'Static',
35+
'bool': 'Static',
36+
'group': 'FieldGroup'
37+
};
38+
39+
let factory = BootstrapFactory.createComponentFactory("details");
40+
41+
expect(factory.defaultFieldComponents).to.be.deep.equal(correctConfig);
1042
done()
1143
})
1244
});

0 commit comments

Comments
 (0)