smartstring/test/test.base64.both.ts
2023-08-18 13:12:25 +02:00

24 lines
820 B
TypeScript

import * as smartstring from '../ts/index.js';
import { tap, expect } from '@push.rocks/tapbundle';
// Base64
let testBase64: smartstring.Base64;
tap.test('expect create a valid instance of Base64', async () => {
testBase64 = new smartstring.Base64('somestring', 'string');
expect(testBase64).toBeInstanceOf(smartstring.Base64);
});
tap.test('expect read output a file as base64 and base64uri', async () => {
expect(testBase64.base64String).not.toEqual(testBase64.base64UriString);
let testBase64_2 = new smartstring.Base64(testBase64.base64UriString, 'base64uri');
expect(testBase64_2.simpleString).toEqual(testBase64.simpleString);
});
tap.test('should test for a valid base64 token', async () => {
const result = smartstring.base64.isBase64('dGVzdA==');
expect(result).toBeTrue();
});
tap.start();