Skip to content

Instantly share code, notes, and snippets.

@garbles
Last active March 12, 2017 05:06
Show Gist options
  • Save garbles/356c15539f202e48f1c6cd5586b022d1 to your computer and use it in GitHub Desktop.
Save garbles/356c15539f202e48f1c6cd5586b022d1 to your computer and use it in GitHub Desktop.
import type {Person} from './types';
export default function setName(person: Person, name: string): Person {
return {
...person,
name
};
}
import setName from './setName';
require('jasmine-check').install();
describe('setName', () => {
check.it('sets a new name', [setName.asGenerator()], (args) => {
const [person, newName] = args;
const next = setName(...args);
expect(next.name).toEqual(newName);
expect(person).not.toBe(next);
});
});
export type Person = {
name: string,
age: number
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment