-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathgulp-prefixer-test.js
28 lines (27 loc) · 1016 Bytes
/
gulp-prefixer-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// LICENSE : MIT
"use strict";
import assert from "power-assert";
import {createReadStream} from "fs";
import {prefixBuffer, prefixStream} from "../../src/gulp/gulp-prefixer";
describe("gulp-prefixer-test", function () {
describe("#prefixBuffer", function () {
it("should add prefix text to buffer", function () {
let result = prefixBuffer(Buffer("text"), "prefix");
assert.equal(result.toString(), "prefixtext");
});
});
describe("#prefixStream", function () {
it("should add prefix text to stream", function (done) {
let buffer = "";
let stream = createReadStream(__dirname + "/fixtures/text.txt");
stream.pipe(prefixStream("prefix"))
.on("data", function (chunk) {
buffer += chunk;
})
.on("end", function () {
assert.equal(buffer.toString(), "prefixtext");
done();
});
});
});
});