Skip to content

Commit ba11851

Browse files
committed
test(*): fix tests
1 parent 3b9b669 commit ba11851

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed
Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
11
// import { ProjectInfo } from 'honeybee-schema';
22
import { sum } from './sum';
3-
import { Room2D, Room2DPropertiesAbridged } from 'dragonfly-schema';
3+
import { Room2D, Room2DPropertiesAbridged, Story } from 'dragonfly-schema';
44

55
test('adds 1 + 2 to equal 3', () => {
66
expect(sum(1, 2)).toBe(3);
77
});
88

9-
// test('tt', () => {
10-
// const obj = new ProjectInfo();
11-
// obj.north = 10;
12-
// const jsonObj = obj.toJSON();
13-
// expect(jsonObj.north).toBe(10);
14-
// });
15-
9+
test('test story', () => {
10+
const obj = new Story();
11+
obj.floorHeight = 10;
12+
const jsonObj = obj.toJSON();
13+
expect(jsonObj.floor_height).toBe(10);
14+
15+
const newObj = Story.fromJS(jsonObj);
16+
expect(newObj.floorHeight).toBe(10);
17+
18+
});
19+
1620

1721
test('test roomProperty', () => {
18-
const roomData = {
19-
"type": "Room2DPropertiesAbridged",
20-
"energy": { "type": "Room2DEnergyPropertiesAbridged" }
21-
};
22-
const obj = Room2DPropertiesAbridged.fromJS(roomData);
23-
expect(obj.validate()).resolves.toBe(true);
24-
25-
const jsonObj = obj.toJSON();
26-
expect(jsonObj.type).toBe("Room2DPropertiesAbridged");
27-
expect(jsonObj).toHaveProperty("energy");
28-
expect(jsonObj.hasOwnProperty("radiance")).toBe(false);
29-
30-
});
22+
const roomData = {
23+
"type": "Room2DPropertiesAbridged",
24+
"energy": { "type": "Room2DEnergyPropertiesAbridged" }
25+
};
26+
const obj = Room2DPropertiesAbridged.fromJS(roomData);
27+
expect(obj.validate()).resolves.toBe(true);
28+
29+
const jsonObj = obj.toJSON();
30+
expect(jsonObj.type).toBe("Room2DPropertiesAbridged");
31+
expect(jsonObj).toHaveProperty("energy");
32+
expect(jsonObj.hasOwnProperty("radiance")).toBe(false);
33+
34+
});

0 commit comments

Comments
 (0)