1
1
// import { ProjectInfo } from 'honeybee-schema';
2
2
import { sum } from './sum' ;
3
- import { Room2D , Room2DPropertiesAbridged } from 'dragonfly-schema' ;
3
+ import { Room2D , Room2DPropertiesAbridged , Story } from 'dragonfly-schema' ;
4
4
5
5
test ( 'adds 1 + 2 to equal 3' , ( ) => {
6
6
expect ( sum ( 1 , 2 ) ) . toBe ( 3 ) ;
7
7
} ) ;
8
8
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
+
16
20
17
21
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