Skip to content

Commit c926bfe

Browse files
committed
test(room2d): add room2d test for TS
1 parent 6270f05 commit c926bfe

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

src/TypeScriptSDK/tests/Room2D.test.ts

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,78 @@ test('test room2d', () => {
210210

211211
});
212212

213+
test('test room2d2', () => {
214+
const roomData = {
215+
"type": "Room2D",
216+
"identifier": "Room_e6ac360b-aaed-4c3b-a130-36b4c2ac9d13-000d14cc",
217+
"display_name": "Laundry-104",
218+
"properties": {
219+
"type": "Room2DPropertiesAbridged",
220+
"energy": { "type": "Room2DEnergyPropertiesAbridged" },
221+
"radiance": { "type": "Room2DRadiancePropertiesAbridged" }
222+
},
223+
"floor_boundary": [
224+
[10.001931517437631, -0.7441439785816385],
225+
[8.290021124356155, -0.744143978581633],
226+
[7.6424815174376315, -0.744143978581631],
227+
[7.642481517437627, -3.3415939785816904],
228+
[10.001931517437628, -3.3415939785816975],
229+
[10.001931517437628, -2.5035939785815233]
230+
],
231+
"floor_height": 0,
232+
"floor_to_ceiling_height": 3,
233+
"is_ground_contact": true,
234+
"is_top_exposed": false,
235+
"boundary_conditions": [
236+
{
237+
"type": "Outdoors",
238+
"sun_exposure": true,
239+
"wind_exposure": true,
240+
"view_factor": { "type": "Autocalculate" }
241+
},
242+
{
243+
"type": "Outdoors",
244+
"sun_exposure": true,
245+
"wind_exposure": true,
246+
"view_factor": { "type": "Autocalculate" }
247+
},
248+
{
249+
"type": "Outdoors",
250+
"sun_exposure": true,
251+
"wind_exposure": true,
252+
"view_factor": { "type": "Autocalculate" }
253+
},
254+
{
255+
"type": "Outdoors",
256+
"sun_exposure": true,
257+
"wind_exposure": true,
258+
"view_factor": { "type": "Autocalculate" }
259+
},
260+
{
261+
"type": "Outdoors",
262+
"sun_exposure": true,
263+
"wind_exposure": true,
264+
"view_factor": { "type": "Autocalculate" }
265+
},
266+
{
267+
"type": "Outdoors",
268+
"sun_exposure": true,
269+
"wind_exposure": true,
270+
"view_factor": { "type": "Autocalculate" }
271+
}
272+
],
273+
"user_data": {}
274+
}
275+
const obj = Room2D.fromJS(roomData);
276+
expect(obj.identifier).toBe("Room_e6ac360b-aaed-4c3b-a130-36b4c2ac9d13-000d14cc");
277+
expect(obj.validate()).resolves.toBe(true);
278+
279+
const jsonObj = obj.toJSON();
280+
const prop = jsonObj["properties"];
281+
expect(prop["energy"].hasOwnProperty("hvac")).toBe(false);
282+
expect(prop.hasOwnProperty("radiance")).toBe(true);
213283

284+
});
214285

215286
test('test roomProperty', () => {
216287
const roomData = {

0 commit comments

Comments
 (0)