Skip to content

Instantly share code, notes, and snippets.

@MeetMartin
Last active March 8, 2019 01:38
Show Gist options
  • Save MeetMartin/a84710771f8d16b89110f33773c021cb to your computer and use it in GitHub Desktop.
Save MeetMartin/a84710771f8d16b89110f33773c021cb to your computer and use it in GitHub Desktop.
import { assert } from 'chai';
import TextTransformation from '../src/text-transform-oop';
describe('test atomic functions', () => {
it('capitalize(text) turns first character to Capital',
() => assert.strictEqual(TextTransformation.capitalize("pReSiDeNt"), 'PReSiDeNt'));
it('addExclamationMark(text) adds !',
() => assert.strictEqual(TextTransformation.addExclamationMark("text"), 'text!'));
it('addPunctuation(text) adds .',
() => assert.strictEqual(TextTransformation.addPunctuation("text"), 'text.'));
});
describe('test composed functions', () => {
it('makeImportant(text) makes it capitalized, trimmed with ! at the end.',
() => assert.strictEqual(TextTransformation.makeImportant(' pReSiDeNt '), 'President!'));
it('makeUnimportant(text) makes it lowercase, trimmed with . at the end.',
() => assert.strictEqual(TextTransformation.makeUnimportant(' pReSiDeNt '), 'president.'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment