28 lines
774 B
TypeScript
28 lines
774 B
TypeScript
import {Base64Decoder} from './base64-decoder';
|
|
|
|
describe('Base64Decoder', () => {
|
|
let sut: Base64Decoder;
|
|
|
|
beforeEach(() => sut = new Base64Decoder());
|
|
|
|
it('should create an instance', () => {
|
|
expect(sut).toBeTruthy();
|
|
});
|
|
|
|
it('should have a display name', () => {
|
|
expect(sut.getDisplayname()).toBeTruthy();
|
|
});
|
|
|
|
it('should have the id "base64decode"', () => {
|
|
expect(sut.getId()).toEqual('base64decode');
|
|
});
|
|
|
|
it('should decode "SGVsbG8sIFdvcmxkIQ==" to "Hello, World!"', () => {
|
|
expect(sut.convert('SGVsbG8sIFdvcmxkIQ==')).toEqual('Hello, World!');
|
|
});
|
|
|
|
it('should raise an exception on invalid input', () => {
|
|
expect(() => sut.convert('foo bar.')).toThrowError('Could not decode base64 string. Maybe corrupt input?');
|
|
});
|
|
});
|