diff options
author | Danijel Andjelkovic <adanijel99@gmail.com> | 2022-03-01 21:54:41 +0100 |
---|---|---|
committer | Danijel Andjelkovic <adanijel99@gmail.com> | 2022-03-01 21:54:41 +0100 |
commit | 6c8128f9fd5a5d0be115806c35a21b3d683df8d6 (patch) | |
tree | f46c2f6b3b9b294ff32bd75c08ccdc9e7a8cc4ef /sandbox/testAppNevena/Front/node_modules/encoding/test | |
parent | 2400b84e95913665da6279114168148444b8f9ab (diff) | |
parent | 7d3640f824f46490b47bd95f1c5a16644f712068 (diff) |
Merge branch 'dev' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into logo
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/encoding/test')
-rw-r--r-- | sandbox/testAppNevena/Front/node_modules/encoding/test/test.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/encoding/test/test.js b/sandbox/testAppNevena/Front/node_modules/encoding/test/test.js new file mode 100644 index 00000000..3a7dfee9 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/encoding/test/test.js @@ -0,0 +1,49 @@ +'use strict'; + +var encoding = require('../lib/encoding'); + +exports['General tests'] = { + 'From UTF-8 to Latin_1': function (test) { + var input = 'ÕÄÖÜ', + expected = Buffer.from([0xd5, 0xc4, 0xd6, 0xdc]); + test.deepEqual(encoding.convert(input, 'latin1'), expected); + test.done(); + }, + + 'From Latin_1 to UTF-8': function (test) { + var input = Buffer.from([0xd5, 0xc4, 0xd6, 0xdc]), + expected = 'ÕÄÖÜ'; + test.deepEqual(encoding.convert(input, 'utf-8', 'latin1').toString(), expected); + test.done(); + }, + + 'From UTF-8 to UTF-8': function (test) { + var input = 'ÕÄÖÜ', + expected = Buffer.from('ÕÄÖÜ'); + test.deepEqual(encoding.convert(input, 'utf-8', 'utf-8'), expected); + test.done(); + }, + + 'From Latin_13 to Latin_15': function (test) { + var input = Buffer.from([0xd5, 0xc4, 0xd6, 0xdc, 0xd0]), + expected = Buffer.from([0xd5, 0xc4, 0xd6, 0xdc, 0xa6]); + test.deepEqual(encoding.convert(input, 'latin_15', 'latin13'), expected); + test.done(); + } + + /* + // ISO-2022-JP is not supported by iconv-lite + "From ISO-2022-JP to UTF-8 with Iconv": function (test) { + var input = Buffer.from( + "GyRCM1g5OzU7PVEwdzgmPSQ4IUYkMnFKczlwGyhC", + "base64" + ), + expected = Buffer.from( + "5a2m5qCh5oqA6KGT5ZOh56CU5L+u5qSc6KiO5Lya5aCx5ZGK", + "base64" + ); + test.deepEqual(encoding.convert(input, "utf-8", "ISO-2022-JP"), expected); + test.done(); + }, + */ +}; |