From 6948e41f09ade72016edb8a001b6ffe17d1b0afe Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Wed, 19 Aug 2020 16:31:52 +0000 Subject: [PATCH] Add a failing test --- test/asserts/file.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/asserts/file.js b/test/asserts/file.js index 6b406be8..842a1833 100644 --- a/test/asserts/file.js +++ b/test/asserts/file.js @@ -442,6 +442,27 @@ QUnit.module("file", function () { }); } + QUnit.test('add UTF-8 text without a Promise', async function (assert) { + var zip = new JSZip(); + zip.file("file.html", "Hèllo"); + const output = await zip.file("file.html").async("text"); + assert.equal(output, "Hèllo"); + }); + + QUnit.test('add UTF-8 text as a Promise with binary: false', async function (assert) { + var zip = new JSZip(); + zip.file("file.html", Promise.resolve("Hèllo"), { binary: false }); + const output = await zip.file("file.html").async("text"); + assert.equal(output, "Hèllo"); + }); + + QUnit.test('add UTF-8 text as a Promise without binary: false', async function (assert) { + var zip = new JSZip(); + zip.file("file.html", Promise.resolve("Hèllo")); + const output = await zip.file("file.html").async("text"); + assert.equal(output, "Hèllo"); + }); + QUnit.test("add file: file(name, polyfill Promise[string] as binary)", function (assert) { var str2promise = function (str) { return new JSZip.external.Promise(function(resolve, reject) {