2022-03-18 21:50:24 +00:00
|
|
|
import * as smartstring from '../ts/index.js';
|
2018-07-21 12:37:39 +00:00
|
|
|
import { tap, expect } from '@pushrocks/tapbundle';
|
2017-10-05 13:55:59 +00:00
|
|
|
|
|
|
|
// Base64
|
2018-07-21 12:37:39 +00:00
|
|
|
let testBase64: smartstring.Base64;
|
2022-09-13 17:23:11 +00:00
|
|
|
|
2017-10-05 13:55:59 +00:00
|
|
|
tap.test('expect create a valid instance of Base64', async () => {
|
2018-07-21 12:37:39 +00:00
|
|
|
testBase64 = new smartstring.Base64('somestring', 'string');
|
2022-03-18 21:50:24 +00:00
|
|
|
expect(testBase64).toBeInstanceOf(smartstring.Base64);
|
2018-07-21 12:37:39 +00:00
|
|
|
});
|
2022-09-13 17:23:11 +00:00
|
|
|
|
2017-10-05 13:55:59 +00:00
|
|
|
tap.test('expect read output a file as base64 and base64uri', async () => {
|
2022-03-18 21:50:24 +00:00
|
|
|
expect(testBase64.base64String).not.toEqual(testBase64.base64UriString);
|
2018-07-21 12:37:39 +00:00
|
|
|
let testBase64_2 = new smartstring.Base64(testBase64.base64UriString, 'base64uri');
|
2022-03-18 21:50:24 +00:00
|
|
|
expect(testBase64_2.simpleString).toEqual(testBase64.simpleString);
|
2018-07-21 12:37:39 +00:00
|
|
|
});
|
2017-10-05 13:55:59 +00:00
|
|
|
|
2022-09-13 17:23:11 +00:00
|
|
|
tap.test('should test for a valid base64 token', async () => {
|
|
|
|
const result = smartstring.base64.isBase64('dGVzdA==');
|
|
|
|
expect(result).toBeTrue();
|
|
|
|
});
|
|
|
|
|
2018-07-21 12:37:39 +00:00
|
|
|
tap.start();
|