Skip to content

Commit 8dd9695

Browse files
committed
Update test sample url
1 parent d3f814d commit 8dd9695

File tree

5 files changed

+57
-20
lines changed

5 files changed

+57
-20
lines changed

.github/workflows/node.js.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ jobs:
2525
with:
2626
node-version: ${{ matrix.node-version }}
2727
- run: cd danfojs-node && yarn
28-
- run: cd danfojs-node && yarn test
28+
- run: cd danfojs-node && yarn test:clean
2929
- run: cd danfojs-browser && yarn
30-
- run: cd danfojs-browser && yarn test
30+
- run: cd danfojs-browser && yarn test:clean

danfojs-browser/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ danfojs/data
66
.DS_Store
77
.idea/
88

9-
dist/
9+
dist/
10+
lib/

danfojs-browser/tests/io/reader.js

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,22 @@ describe("read_csv", async function () {
1414
});
1515

1616
describe("read_json", async function () {
17-
this.timeout(10000); // all tests in this suite get 10 seconds before timeout
17+
this.timeout(100000); // all tests in this suite get 10 seconds before timeout
1818
it("reads a json file from source over the internet", async function () {
1919
const jUrl =
20-
"https://raw.githubusercontent.com/risenW/Tensorflowjs_Projects/master/recommender-sys/Python-Model/web_book_data.json";
20+
"https://raw.githubusercontent.com/opensource9ja/danfojs/dev/danfojs-node/tests/samples/book.json";
2121

2222
const df = await dfd.read_json(jUrl);
23-
const num_of_columns = df.columns.length;
24-
assert.equal(num_of_columns, 4);
23+
assert.deepEqual(df.columns, [
24+
'book_id',
25+
'title',
26+
'image_url',
27+
'authors'
28+
]);
29+
assert.deepEqual(df.dtypes, [
30+
'int32', 'string',
31+
'string', 'string'
32+
]);
2533

2634
});
2735

@@ -31,9 +39,19 @@ describe("read_excel", async function () {
3139
this.timeout(10000); // all tests in this suite get 10 seconds before timeout
3240
it("reads an excel file from source over the internet", async function () {
3341
const remote_url =
34-
"https://file-examples-com.github.io/uploads/2017/02/file_example_XLS_100.xls";
35-
const df = await dfd.read_excel(remote_url, { sheet: 0 });
36-
assert(df.columns.length, 8);
42+
"https://raw.githubusercontent.com/opensource9ja/danfojs/dev/danfojs-node/tests/samples/SampleData.xlsx";
43+
const df = await dfd.read_excel(remote_url);
44+
assert.deepEqual(df.columns, [
45+
'Year',
46+
'Stocks',
47+
'T.Bills',
48+
'T.Bonds'
49+
]);
50+
assert.deepEqual(df.dtypes, [
51+
'int32', 'float32',
52+
'float32', 'float32'
53+
]);
54+
assert.deepEqual(df.shape, [ 82, 4 ]);
3755
});
3856

3957
});

danfojs-node/tests/io/reader.js

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,22 @@ describe("read_csv", async function () {
2323
});
2424

2525
describe("read_json", async function () {
26-
this.timeout(10000); // all tests in this suite get 10 seconds before timeout
26+
this.timeout(100000); // all tests in this suite get 10 seconds before timeout
2727
it("reads a json file from source over the internet", async function () {
2828
const jUrl =
29-
"https://raw.githubusercontent.com/risenW/Tensorflowjs_Projects/master/recommender-sys/Python-Model/web_book_data.json";
29+
"https://raw.githubusercontent.com/opensource9ja/danfojs/dev/danfojs-node/tests/samples/book.json";
3030

3131
const df = await read_json(jUrl);
32-
const num_of_columns = df.columns.length;
33-
assert.equal(num_of_columns, 4);
32+
assert.deepEqual(df.columns, [
33+
'book_id',
34+
'title',
35+
'image_url',
36+
'authors'
37+
]);
38+
assert.deepEqual(df.dtypes, [
39+
'int32', 'string',
40+
'string', 'string'
41+
]);
3442

3543
});
3644

@@ -47,9 +55,19 @@ describe("read_excel", async function () {
4755
this.timeout(10000); // all tests in this suite get 10 seconds before timeout
4856
it("reads an excel file from source over the internet", async function () {
4957
const remote_url =
50-
"https://file-examples-com.github.io/uploads/2017/02/file_example_XLS_100.xls";
51-
const df = await read_excel(remote_url, { sheet: 0 });
52-
assert(df.columns.length, 8);
58+
"https://raw.githubusercontent.com/opensource9ja/danfojs/dev/danfojs-node/tests/samples/SampleData.xlsx";
59+
const df = await read_excel(remote_url);
60+
assert.deepEqual(df.columns, [
61+
'Year',
62+
'Stocks',
63+
'T.Bills',
64+
'T.Bonds'
65+
]);
66+
assert.deepEqual(df.dtypes, [
67+
'int32', 'float32',
68+
'float32', 'float32'
69+
]);
70+
assert.deepEqual(df.shape, [ 82, 4 ]);
5371
});
5472

5573
it("reads an excel file from source from local disk", async function () {

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"workspaces": [
55
"danfojs-node/**",
66
"danfojs-browser/**"
7-
],
7+
],
88
"scripts": {
9-
"build": "cd danfojs-node && yarn build && cd ../danfojs-browser && yarn bundle",
10-
"test": "cd danfojs-node && yarn test && cd ../danfojs-browser && yarn test"
9+
"build": "cd danfojs-node && yarn build:clean && cd ../danfojs-browser && yarn build:clean",
10+
"test": "cd danfojs-node && yarn && yarn test:clean && cd ../danfojs-browser && yarn && yarn test:clean"
1111
}
1212
}

0 commit comments

Comments
 (0)