Created
March 17, 2020 20:26
-
-
Save aalencar/1963c469670cf29f59aea86e8a801b94 to your computer and use it in GitHub Desktop.
Example on how to better organize your test using Jest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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