Skip to content

Commit

Permalink
Move tests to better placed directory
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalCz committed Nov 7, 2018
1 parent 64a5be1 commit 283ac76
Show file tree
Hide file tree
Showing 87 changed files with 1,320 additions and 4,354 deletions.
2 changes: 1 addition & 1 deletion gulpfile.js
Expand Up @@ -29,7 +29,7 @@ gulp.task("test_legacy", test_legacy([path.resolve(corepath, "../test/v1/*.js"),

gulp.task("scm_clean", scm_clean());

gulp.task("test_samples", shell.task("node test/samples/test-samples"));
gulp.task("test_samples", shell.task("node scripts/test/test-samples"));

gulp.task("readme", readme({
files: FILES.slice(),
Expand Down
42 changes: 21 additions & 21 deletions lib/data-stream.js
Expand Up @@ -24,7 +24,7 @@ module.exports = {
* @param {Readable} incoming
* @returns {Number} resolved when incoming stream ends, rejects on incoming error
*
* @example {@link ../samples/data-stream-pull.js}
* @test test/methods/data-stream-pull.js
*/
async pull(incoming) {
return new Promise((res, rej) => {
Expand All @@ -49,7 +49,7 @@ module.exports = {
* @param {Number} count The number of items to shift.
* @param {ShiftCallback} func Function that receives an array of shifted items
*
* @example {@link ../samples/data-stream-shift.js}
* @test test/methods/data-stream-shift.js
*/
shift(count, func) {
const ret = [];
Expand Down Expand Up @@ -131,7 +131,7 @@ module.exports = {
* @param {Number} [start=0] omit this number of entries.
* @param {Number} [length=Infinity] get this number of entries to the resulting stream
*
* @example {@link ../samples/data-stream-slice.js}
* @test test/methods/data-stream-slice.js
*/
slice(start = 0, length = Infinity) {
let n = 0;
Expand All @@ -149,7 +149,7 @@ module.exports = {
* @memberof DataStream#
* @param {MapCallback|Object} func The function that returns new object properties or just the new properties
*
* @example {@link ../samples/data-stream-assign.js}
* @test test/methods/data-stream-assign.js
*/
assign(func) {
if (typeof func === "function") {
Expand All @@ -171,7 +171,7 @@ module.exports = {
* @memberof DataStream#
* @param {Function} callback Function called when stream ends
*
* @example {@link ../samples/data-stream-empty.js}
* @test test/methods/data-stream-empty.js
*/
empty(callback) {
let z = false;
Expand Down Expand Up @@ -216,7 +216,7 @@ module.exports = {
* @param {*} item list of items to push at end
* @meta.noreadme
*
* @example {@link ../samples/data-stream-endwith.js}
* @test test/methods/data-stream-endwith.js
*/
endWith(...items) {
// TODO: overhead on unneeded transform, but requires changes in core.
Expand All @@ -243,7 +243,7 @@ module.exports = {
* @return {Promise} resolved with the "into" object on stream end.
* @meta.noreadme
*
* @example {@link ../samples/data-stream-accumulate.js}
* @test test/methods/data-stream-accumulate.js
*/
async accumulate(func, into) {
return new Promise((res, rej) => {
Expand Down Expand Up @@ -310,7 +310,7 @@ module.exports = {
* function
* @return {*} whatever was passed as into
*
* @example {@link ../samples/data-stream-reduceNow.js}
* @test test/methods/data-stream-reduceNow.js
*/
reduceNow(func, into) {
const prm = this.reduce(func, into);
Expand Down Expand Up @@ -341,7 +341,7 @@ module.exports = {
* @param {class} Clazz Optional DataStream subclass to be constructed
* @return {DataStream} a new DataStream of the given class with new chunks
*
* @example {@link ../samples/data-stream-remap.js}
* @test test/methods/data-stream-remap.js
*/
remap(func, Clazz) {

Expand Down Expand Up @@ -374,7 +374,7 @@ module.exports = {
* @param {class} Clazz Optional DataStream subclass to be constructed
* @return {DataStream} a new DataStream of the given class with new chunks
*
* @example {@link ../samples/data-stream-flatmap.js}
* @test test/methods/data-stream-flatmap.js
*/
flatMap(func, Clazz = DataStream) {
const ref = new Clazz({referrer: this});
Expand Down Expand Up @@ -408,7 +408,7 @@ module.exports = {
* @memberof DataStream#
* @return {DataStream}
*
* @example {@link ../samples/data-stream-flatten.js}
* @test test/methods/data-stream-flatten.js
*/
flatten() {
return this.into(
Expand All @@ -430,7 +430,7 @@ module.exports = {
* @memberof DataStream#
* @param {*} streams Streams to be passed
*
* @example {@link ../samples/data-stream-concat.js}
* @test test/methods/data-stream-concat.js
*/
concat(...streams) {
const out = this._selfInstance({referrer: this});
Expand All @@ -455,7 +455,7 @@ module.exports = {
* @memberof DataStream#
* @param {*|JoinCallback} item An object that should be interweaved between stream items
*
* @example {@link ../samples/data-stream-join.js}
* @test test/methods/data-stream-join.js
*/
join(item) {
const ref = this._selfInstance({referrer: this});
Expand Down Expand Up @@ -493,7 +493,7 @@ module.exports = {
* @memberof DataStream#
* @param {number} count Number of objects or -1 for all the stream
*
* @example {@link ../samples/data-stream-keep.js}
* @test test/methods/data-stream-keep.js
*/
keep(count = -1) {
if (count < 0)
Expand Down Expand Up @@ -612,7 +612,7 @@ module.exports = {
* @param {Object} createOptions options to use to create the separated streams
* @return {MultiStream} separated stream
*
* @example {@link ../samples/data-stream-separate.js}
* @test test/methods/data-stream-separate.js
*/
separate(affinity, createOptions, CreateClass) {
const ret = new MultiStream();
Expand Down Expand Up @@ -683,7 +683,7 @@ module.exports = {
* @memberof DataStream#
* @param {Number} count How many items to aggregate
*
* @example {@link ../samples/data-stream-batch.js}
* @test test/methods/data-stream-batch.js
*/
batch(count) {
let arr = [];
Expand Down Expand Up @@ -719,7 +719,7 @@ module.exports = {
* @param {Number} ms Maximum ammount of milliseconds
* @param {Number} count Maximum number of items in batch (otherwise no limit)
*
* @example {@link ../samples/data-stream-timebatch.js}
* @test test/methods/data-stream-timebatch.js
*/
timeBatch(ms, count = Infinity) {
let arr = [];
Expand Down Expand Up @@ -810,7 +810,7 @@ module.exports = {
* @return {StringStream}
* @meta.noreadme
*
* @example {@link ../samples/data-stream-tojsonarray.js}
* @test test/methods/data-stream-tojsonarray.js
*/
toJSONArray(enclosure = ["[\n", "\n]"], separator = ",\n", stringify = JSON.stringify) {
const ref = new StringStream({referrer: this});
Expand Down Expand Up @@ -840,7 +840,7 @@ module.exports = {
* @return {StringStream}
* @meta.noreadme
*
* @example {@link ../samples/data-stream-tojsonobject.js}
* @test test/methods/data-stream-tojsonobject.js
*/
toJSONObject(entryCallback, enclosure = ["{\n","\n}"], separator = ",\n") {
let ref = this;
Expand Down Expand Up @@ -874,7 +874,7 @@ module.exports = {
* @param options options for the papaparse.unparse module.
* @return {StringStream} stream of parsed items
*
* @example {@link ../samples/data-stream-csv.js}
* @test test/methods/data-stream-csv.js
*/
CSVStringify(options = {}) {
const Papa = require("papaparse");
Expand Down Expand Up @@ -919,7 +919,7 @@ module.exports = {
* @param {Function} func if passed, the function will be called on self to add an option to inspect the stream in place, while not breaking the transform chain
* @return {DataStream} self
*
* @example {@link ../samples/data-stream-debug.js}
* @test test/methods/data-stream-debug.js
*/
debug(func) {
debugger; // eslint-disable-line
Expand Down
8 changes: 4 additions & 4 deletions lib/string-stream.js
Expand Up @@ -9,7 +9,7 @@ module.exports = {
* @memberof StringStream#
* @param {String} [eol=/\r?\n/] End of line string
*
* @example {@link ../samples/string-stream-split.js}
* @test test/methods/string-stream-split.js
*/
lines(eol = /\r?\n/) {
return this.split(eol);
Expand Down Expand Up @@ -40,7 +40,7 @@ module.exports = {
* @memberof StringStream#
* @param options options for the papaparse.parse method.
* @return {DataStream} stream of parsed items
* @example {@link ../samples/data-stream-separate.js}
* @test test/methods/data-stream-separate.js
*/
CSVParse(options = {}) {
const out = new DataStream();
Expand Down Expand Up @@ -74,7 +74,7 @@ module.exports = {
* @memberof StringStream#
* @param {Function|String} arg the argument to append. If function passed then it will be called and resolved and the resolution will be appended.
*
* @example {@link ../samples/string-stream-append.js}
* @test test/methods/string-stream-append.js
*/
append(arg) {
return typeof arg === "function" ? this.map(item => Promise.resolve(item).then(arg).then((result) => item + result)) : this.map(item => item + arg);
Expand All @@ -88,7 +88,7 @@ module.exports = {
* @param {Function|String} arg the argument to prepend. If function passed then it will be called and resolved
* and the resolution will be prepended.
*
* @example {@link ../samples/string-stream-prepend.js}
* @test test/methods/string-stream-prepend.js
*/
prepend(arg) {
return typeof arg === "function" ? this.map(item => Promise.resolve(item).then(arg).then((result) => result + item)) : this.map(item => arg + item);
Expand Down

0 comments on commit 283ac76

Please sign in to comment.