Skip to content

Commit

Permalink
chore(tests): Move stream tests into WritableStream.spec (#916)
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Aug 23, 2021
1 parent 5d5c46e commit da67eba
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 33 deletions.
31 changes: 31 additions & 0 deletions src/WritableStream.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import fs from "fs";
import path from "path";
import { WritableStream } from "./WritableStream";
import * as helper from "./__fixtures__/test-helper";

describe("WritableStream", () => {
test("should decode fragmented unicode characters", () => {
Expand All @@ -13,3 +16,31 @@ describe("WritableStream", () => {
expect(ontext).toBeCalledWith("€");
});
});

helper.createSuite("Stream", (test, cb) => {
const filePath = path.join(
__dirname,
"__fixtures__",
"Documents",
test.file
);

fs.createReadStream(filePath)
.pipe(
new WritableStream(
helper.getEventCollector((err, events) => {
cb(err, events);

const handler = helper.getEventCollector(cb);
const stream = new WritableStream(handler, test.options);

fs.readFile(filePath, (err, data) => {
if (err) throw err;
stream.end(data);
});
}),
test.options
)
)
.on("error", cb);
});
33 changes: 0 additions & 33 deletions src/__tests__/stream.ts

This file was deleted.

0 comments on commit da67eba

Please sign in to comment.