-
Notifications
You must be signed in to change notification settings - Fork 665
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
94 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
if (typeof exports === 'object') { | ||
var assert = require('assert'); | ||
var alasql = require('..'); | ||
} | ||
|
||
/* | ||
Test for issue #1919 | ||
*/ | ||
describe(`Test 1919 Load data from JSONL file`, function () { | ||
const expectedResult = [ | ||
{ | ||
a: 'foo', | ||
b: 5, | ||
c: true, | ||
d: null | ||
}, | ||
{ | ||
a: 'bar', | ||
b: 8, | ||
c: false, | ||
d: null | ||
} | ||
]; | ||
it('1. Load JSONL', function (done) { | ||
alasql('SELECT * FROM JSONL("' + __dirname + '/test1919")', [], function (res) { | ||
assert.deepEqual(res, expectedResult); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('2. Load NDJSON', function (done) { | ||
alasql('SELECT * FROM NDJSON("' + __dirname + '/test1919")', [], function (res) { | ||
assert.deepEqual(res, expectedResult); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('3. Load NDJSON - will accept file with different extension', function (done) { | ||
alasql('SELECT * FROM NDJSON("' + __dirname + '/test1919.jsonl")', [], function (res) { | ||
assert.deepEqual(res, expectedResult); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('4. Load JSONL - will accept file with different extension', function (done) { | ||
alasql('SELECT * FROM JSONL("' + __dirname + '/test1919.ndjson")', [], function (res) { | ||
assert.deepEqual(res, expectedResult); | ||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{"a":"foo","b":5.0,"c":true,"d":null} | ||
{"a":"bar","b":8.0,"c":false,"d":null} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{"a":"foo","b":5.0,"c":true,"d":null} | ||
{"a":"bar","b":8.0,"c":false,"d":null} |