Skip to content

Commit ad262a0

Browse files
committed
Adjust time series group test for faster response
The getTimeSeriesGroup request has a very slow response for large numbers of time series. Toggled off the includeAssigned option to only return the groups themselves.
1 parent 485dcfc commit ad262a0

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

tests/endpoints/TimeSeries-Groups.test.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,19 @@ test("Test TS Groups", async () => {
1111

1212
// Initialize the timeseries groups api with the default config
1313
const tsg_api = new TimeSeriesGroupsApi();
14+
15+
const testOffice = "SWT";
16+
1417
// Fetch ALL timeseries groups for the given office
15-
await tsg_api.getTimeSeriesGroup({ office: "SWT" }).then((data) => {
16-
expect(data[0]).toBeDefined();
17-
data.forEach((group) => {
18-
expect(group.assignedTimeSeries).toBeDefined();
19-
const TSIDS = group.assignedTimeSeries.map((ts) => ts.timeseriesId);
20-
expect(TSIDS).toBeDefined();
21-
console.log(`Fetched ${TSIDS.length} timeseries for group ${group.id}`);
18+
await tsg_api
19+
.getTimeSeriesGroup({ office: testOffice, includeAssigned: false })
20+
.then((data) => {
21+
expect(data[0]).toBeDefined();
22+
data.forEach((group) => {
23+
expect(group.officeId).toBeDefined();
24+
});
25+
console.log(`Fetched ${data.length} groups for office ${testOffice}`);
2226
});
23-
});
2427

2528
// Fetch a specific timeseries groups given an ID for the given office
2629
await tsg_api
@@ -36,4 +39,4 @@ test("Test TS Groups", async () => {
3639
expect(TSIDS).toBeDefined();
3740
console.log(`Fetched ${TSIDS.length} timeseries for group ${group.id}`);
3841
});
39-
}, 20000);
42+
});

0 commit comments

Comments
 (0)