-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
09c53a4
commit 4287740
Showing
2 changed files
with
37 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
if (typeof exports === 'object') { | ||
var assert = require('assert'); | ||
var alasql = require('..'); | ||
} else { | ||
__dirname = '.'; | ||
} | ||
|
||
describe('Test 1415 - UNION Expression with empty query columns bug', function () { | ||
it('1. should not insert empty objects in results when using UNION Expression', function (done) { | ||
var data1 = [ | ||
{a: 'abc'}, | ||
{a: 'xyz'} | ||
]; | ||
var data2 = [ | ||
{a: '123'}, | ||
{a: '987'} | ||
]; | ||
|
||
var res = alasql("SELECT * FROM :a UNION SELECT * FROM :b", {a: data1, b: data2}); | ||
assert.deepEqual(res, [{a: '123'}, {a: '987'}, { a: 'abc'}, {a: 'xyz'}]); | ||
|
||
var res = alasql("SELECT * FROM @[{x: true}, {x: 3}] UNION SELECT * FROM @[{x: false}, {x: 9}]"); | ||
assert.deepEqual(res, [{x: false}, {x: 9}, {x: true}, {x: 3}]); | ||
|
||
done(); | ||
}); | ||
}); |