mirror of
https://github.com/cupcakearmy/occulto.git
synced 2024-11-01 06:04:17 +01:00
add tests for hex
This commit is contained in:
parent
5ce25e41c2
commit
211d5f7629
@ -1,7 +1,18 @@
|
|||||||
import { Base64, Bytes } from '../dist/index.js'
|
import { Base64, Bytes, Hex } from '../dist/index.js'
|
||||||
import { Precomputed } from './values.js'
|
import { Precomputed } from './values.js'
|
||||||
|
|
||||||
describe('Encoding', () => {
|
describe('Encoding', () => {
|
||||||
|
describe('Hex', () => {
|
||||||
|
for (const [input, output] of Object.entries(Precomputed.Encoding.Hex)) {
|
||||||
|
const buffer = Bytes.encode(input)
|
||||||
|
it(`Should encode ${input} to ${output}`, async () => {
|
||||||
|
chai.expect(await Hex.encode(buffer)).to.equal(output)
|
||||||
|
})
|
||||||
|
it(`Should decode ${output} to ${input}`, async () => {
|
||||||
|
chai.expect(await Hex.decode(output)).to.deep.equal(buffer)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
describe('Base64', () => {
|
describe('Base64', () => {
|
||||||
for (const [input, output] of Object.entries(Precomputed.Encoding.Base64)) {
|
for (const [input, output] of Object.entries(Precomputed.Encoding.Base64)) {
|
||||||
const buffer = Bytes.encode(input)
|
const buffer = Bytes.encode(input)
|
||||||
|
@ -5,6 +5,11 @@ export const Precomputed = {
|
|||||||
test: 'dGVzdA==',
|
test: 'dGVzdA==',
|
||||||
'hello world': 'aGVsbG8gd29ybGQ=',
|
'hello world': 'aGVsbG8gd29ybGQ=',
|
||||||
},
|
},
|
||||||
|
Hex: {
|
||||||
|
test: '74657374',
|
||||||
|
occulto: '6f6363756c746f',
|
||||||
|
'hello world': '68656c6c6f20776f726c64',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Hash: {
|
Hash: {
|
||||||
SHA_1: {
|
SHA_1: {
|
||||||
|
Loading…
Reference in New Issue
Block a user