Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example on how to better organize your test using Jest
describe('Person', () => {
describe('#setName', () => {
it('should set name when name is passed', () => {
const person = new Person();
const name = 'Alex';
person.setName(name);
expect(person.name).toBe(name);
});
});
});
export class Person {
age: number;
name: string;
setName(name: string) {
this.name = name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment