Skip to content

Instantly share code, notes, and snippets.

@meza
Created March 21, 2019 00:06
Show Gist options
  • Save meza/074589a2a12dbe584d464b5f4f540adb to your computer and use it in GitHub Desktop.
Save meza/074589a2a12dbe584d464b5f4f540adb to your computer and use it in GitHub Desktop.
Randomised test
import Chance from 'chance';
const chance = new Chance();
const functionUnderTest = (input) => {
return input.veryImportant
}
describe('Simple test', () => {
it('Expects something to happen', () => {
const inputString = chance.string();
const testData = {
input: inputString,
expectedOutput: inputString
}
const config = {
veryImportant: testData.input
};
const result = functionUnderTest(config);
expect(result).toBe(testData.expectedOutput);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment