-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed and added test for blend method.
- Loading branch information
1 parent
60cdd2c
commit 3a638a5
Showing
4 changed files
with
114 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.DS_Store | ||
Thumbs.db | ||
node_modules | ||
*.tmp* |
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,18 @@ | ||
var blend = require('../blend.js'); | ||
var assert = require('chai').assert; | ||
|
||
function assertGridEqual(result, expected){ | ||
assert.deepEqual(result.keys, expected.keys, 'keys should match'); | ||
for(var i = 0; i < expected.grid.length; i++){ | ||
assert.equal(result.grid[i], expected.grid[i], 'row '+i+' should match'); | ||
}; | ||
assert.deepEqual(result.data, expected.data, 'data property should match'); | ||
} | ||
|
||
describe('blend()', function() { | ||
it('should merge utfgrids', function() { | ||
var fixture = require('./fixtures/a.js'); | ||
var output = blend(fixture.inputs); | ||
assertGridEqual(output, fixture.result); | ||
}); | ||
}); |
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,65 @@ | ||
module.exports.inputs = [{ | ||
"data": { | ||
"1": {"id": 1}, | ||
"2": {"id": 2}, | ||
"3": {"id": 3}, | ||
"4": {"id": 4}, | ||
"5": {"id": 5}, | ||
"6": {"id": 6} | ||
}, | ||
"keys": ["","1","2","3","4","5","6"], | ||
"grid": [ | ||
" ", | ||
" ", | ||
" ", | ||
" ", | ||
" !#$ ", | ||
" %&' ", | ||
" ", | ||
" " | ||
] | ||
},{ | ||
"data": { | ||
"1": {"id": 7}, | ||
"2": {"id": 8}, | ||
"3": {"id": 9}, | ||
"4": {"id": 10}, | ||
"5": {"id": 11}, | ||
"6": {"id": 12} | ||
}, | ||
"keys": ["","1","2","3","4","5","6"], | ||
"grid": [ | ||
" ", | ||
" ", | ||
" ", | ||
" ", | ||
" ", | ||
" !#$ ", | ||
" %&' ", | ||
" " | ||
] | ||
}]; | ||
module.exports.result = { | ||
"data": { | ||
"1": {"id": 1}, | ||
"2": {"id": 2}, | ||
"3": {"id": 3}, | ||
"4": {"id": 7}, | ||
"5": {"id": 8}, | ||
"6": {"id": 9}, | ||
"7": {"id": 10}, | ||
"8": {"id": 11}, | ||
"9": {"id": 12}, | ||
}, | ||
"keys": ["","1","2","3","4","5","6","7","8","9"], | ||
"grid": [ | ||
" ", | ||
" ", | ||
" ", | ||
" ", | ||
" !#$ ", | ||
" %&' ", | ||
" ()* ", | ||
" " | ||
] | ||
}; |