-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
33 lines (26 loc) · 970 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { expect } from 'chai'
import { encode, decode } from './'
describe('base64object', () => {
describe('encode', () => {
it('returns false if nothing is passed', () => {
expect(encode()).to.equal(false)
})
it('returns correct base64 if i pass a simple string', () => {
expect(encode('base64 me baby')).to.equal('ImJhc2U2NCBtZSBiYWJ5Ig==')
})
it('returns correct base64 if i pass a object', () => {
expect(encode({ hello: 'world' })).to.equal('eyJoZWxsbyI6IndvcmxkIn0=')
})
})
describe('decode', () => {
it('returns false if nothing is passed', () => {
expect(decode()).to.equal(false)
})
it('returns correct base64 if i pass a simple string', () => {
expect(decode('ImJhc2U2NCBtZSBiYWJ5Ig==')).to.equal('base64 me baby')
})
it('returns correct base64 if i pass a object', () => {
expect(decode('eyJoZWxsbyI6IndvcmxkIn0=')).to.deep.equal({ hello: 'world' })
})
})
})