Fixed tests, added tests, fixed ducked up things

This commit is contained in:
Alexander Cerutti
2021-10-11 23:04:09 +02:00
parent cba4d10fd0
commit 928081ecfc
6 changed files with 216 additions and 134 deletions

View File

@@ -43,11 +43,27 @@ describe("Bundle", () => {
expect(bundle.getAsStream()).toBeInstanceOf(Stream);
});
it("should freeze the bundle when using 'getAsStream'", () => {
bundle.getAsStream();
expect(bundle.isFrozen).toBe(true);
});
it("should return a buffer with 'getAsBuffer'", async () => {
addEmptyFilesToBundle(bundle);
expect(await bundle.getAsBuffer()).toBeInstanceOf(Buffer);
});
it("should freeze the bundle when using 'getAsBuffer'", async () => {
await bundle.getAsBuffer();
expect(bundle.isFrozen).toBe(true);
});
it("freezables should expose freezable and bundle itself to be frozen", () => {
const [bundle, freeze] = Bundle.freezable("any/any");
freeze();
expect(bundle.isFrozen).toBe(true);
});
});
function addEmptyFilesToBundle(bundle: Bundle) {