jest test description inside it code example
Example 1: beforeeach jest
describe('some testing', () => {
let isCity;
beforeEach(() => {
isCity = 'Vienna';
});
afterEach(() => {
isCity = null;
});
test('city database has Vienna', () => {
expect(isCity('Vienna')).toBeTruthy();
});
test('city database has San Juan', () => {
expect(isCity('San Juan')).toBeTruthy();
});
}
Example 2: jest it vs test
// In the docs it says:
// it is an alias of test. So they are exactly the same.
// it() -> test()