Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added testing of samples from core, legacy tests from core and a vune…
…rability check, core now at 3.1.4
- Loading branch information
Showing
9 changed files
with
233 additions
and
171 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,3 @@ | ||
# Ignore all differences in line endings | ||
* -crlf | ||
|
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,45 +1,45 @@ | ||
#!/usr/bin/env node | ||
// module: data-stream, method: filter | ||
|
||
const DataStream = require('../').DataStream; | ||
|
||
exports.stream = () => DataStream.fromArray([1,2,3,4,5,6,7,8,9,10]) | ||
.filter((num) => num % 2 === 0) // return true for even numbers | ||
; | ||
|
||
exports.test = { | ||
normal: (test) => { | ||
|
||
test.expect(2); | ||
|
||
const returned = exports.stream(); | ||
|
||
returned | ||
.once("data", (num) => { | ||
test.equals(num, 2, "First item must be even"); | ||
}) | ||
.toArray() | ||
.then( | ||
(ret) => { | ||
test.equals(ret.toString(), '2,4,6,8,10', "Odd items need to be filtered out"); | ||
test.done(); | ||
} | ||
); | ||
}, | ||
filterAll: (test) => { | ||
|
||
test.expect(1); | ||
|
||
DataStream.fromArray([1,2,3,4,5]) | ||
.filter(() => 0) | ||
.map(() => test.ok(false, "No data should be outputted even on merged transforms")) | ||
.on("data", () => test.ok(false, "No data should be emitted")) | ||
.on("end", () => { | ||
test.ok(true, "Stream should end"); | ||
test.done(); | ||
}); | ||
|
||
} | ||
}; | ||
|
||
exports.log = console.log.bind(console); | ||
#!/usr/bin/env node | ||
// module: data-stream, method: filter | ||
|
||
const DataStream = require('../').DataStream; | ||
|
||
exports.stream = () => DataStream.fromArray([1,2,3,4,5,6,7,8,9,10]) | ||
.filter((num) => num % 2 === 0) // return true for even numbers | ||
; | ||
|
||
exports.test = { | ||
normal: (test) => { | ||
|
||
test.expect(2); | ||
|
||
const returned = exports.stream(); | ||
|
||
returned | ||
.once("data", (num) => { | ||
test.equals(num, 2, "First item must be even"); | ||
}) | ||
.toArray() | ||
.then( | ||
(ret) => { | ||
test.equals(ret.toString(), '2,4,6,8,10', "Odd items need to be filtered out"); | ||
test.done(); | ||
} | ||
); | ||
}, | ||
filterAll: (test) => { | ||
|
||
test.expect(1); | ||
debugger; | ||
DataStream.fromArray([1,2,3,4,5]) | ||
.filter(() => 0) | ||
.map(() => test.ok(false, "No data should be outputted even on merged transforms")) | ||
.on("data", () => test.ok(false, "No data should be emitted")) | ||
.on("end", () => { | ||
test.ok(true, "Stream should end"); | ||
test.done(); | ||
}); | ||
|
||
} | ||
}; | ||
|
||
exports.log = console.log.bind(console); |
Oops, something went wrong.