-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
data_test.js
44 lines (37 loc) · 1.59 KB
/
data_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
import {JenaWeatherData} from "./data";
global.fetch = require('node-fetch');
describe('JenaWeatherData', () => {
it('construct, load and basic public methods', async () => {
const dataset = new JenaWeatherData();
await dataset.load();
expect(dataset.getDataColumnNames().length).toEqual(14);
expect(dataset.getDataColumnNames()[0]).toEqual('p (mbar)');
expect(dataset.getDataColumnNames()[1]).toEqual('T (degC)');
expect(new Date(dataset.getTime(0)).getTime()).toBeGreaterThan(0);
const columnData = dataset.getColumnData('T (degC)', false, true, 0, 30, 3);
expect(columnData.length).toEqual(10);
const func = dataset.getNextBatchFunction(
true, 1000, 100, 32, 10, 0, 10000, true, false);
for (let i = 0; i < 2; ++i) {
const item = func.next();
expect(item.done).toEqual(false);
expect(item.value.xs.shape).toEqual([32, 100, 14]);
}
});
});