Skip to content

Commit

Permalink
run added test for all encodings
Browse files Browse the repository at this point in the history
  • Loading branch information
gyzerok committed Jun 22, 2020
1 parent f9679e7 commit 5c42bb3
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions test/webpack/basic-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,15 @@ describe("iconv-lite", function() {
assert.equal(str, "💩");
});

[
'utf8',
'utf16le',
'utf16be',
'ucs2',
'binary',
'latin1',
'big5',
'gbk',
'cesu8',
'shiftjis',
'cp1251',
'cp1253',
'cp1254',
'armscii8'
].forEach(function(encoding) {
it("supports Uint8Array for " + encoding, function() {
it("supports passing Uint8Array to decode for all encodings", function() {
iconv.encode('', 'utf8'); // Load all encodings.

const encodings = Object.keys(iconv.encodings)
encodings.forEach(function(encoding) {
if (['base64', 'hex', '_internal', '0'].indexOf(encoding) >= 0) {
return;
}

var expected = 'Lorem ipsum';

var encoded = iconv.encode(expected, encoding);
Expand All @@ -64,8 +56,8 @@ describe("iconv-lite", function() {
const uint8Array = Uint8Array.from(byteArray);

var actual = iconv.decode(uint8Array, encoding);
assert.equal(actual, expected);
});
assert.equal(actual, expected, encoding);
})
});
});

Expand Down

0 comments on commit 5c42bb3

Please sign in to comment.