mirror of
https://github.com/standardnotes/server
synced 2026-10-13 00:13:41 -04:00
30 lines
670 B
TypeScript
30 lines
670 B
TypeScript
import 'reflect-metadata'
|
|
|
|
import { ContentDecoder } from './ContentDecoder'
|
|
|
|
describe('ContentDecoder', () => {
|
|
const createDecoder = () => new ContentDecoder()
|
|
|
|
it('should decode content', () => {
|
|
const content = '000eyJmb28iOiJiYXIifQ=='
|
|
|
|
expect(createDecoder().decode(content)).toEqual({
|
|
foo: 'bar',
|
|
})
|
|
})
|
|
|
|
it('should encode content', () => {
|
|
expect(
|
|
createDecoder().encode({
|
|
foo: 'bar',
|
|
}),
|
|
).toEqual('000eyJmb28iOiJiYXIifQ==')
|
|
})
|
|
|
|
it('should return empty object on decoding failure', () => {
|
|
const content = '032400eyJmb28iOiJiYXIifQ=='
|
|
|
|
expect(createDecoder().decode(content)).toEqual({})
|
|
})
|
|
})
|