Skip to content

Instantly share code, notes, and snippets.

@meza
Created March 21, 2019 00:30
Show Gist options
  • Save meza/fd8fcf73e0a4f24cc3d689675ae8dab7 to your computer and use it in GitHub Desktop.
Save meza/fd8fcf73e0a4f24cc3d689675ae8dab7 to your computer and use it in GitHub Desktop.
import Chance from 'chance';
const seedGenerator = new Chance()
const seed = process.env.SEED || seedGenerator.hash();
const chance = new Chance(seed);
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