Sign in
Log inSign up

With Jest, is it ok to consider each `describe()` as a linear scenario in which each `it()` relies on the state (of the tested system) created by previous `it()` test cases?

Adrien Joly's photo
Adrien Joly
·Sep 14, 2018

Example:

describe('jobs-runner', () => {
  it('can accept a new job', () => {
    system.add({ job: DUMMY });
    expect(system.getJobs()).toHaveLength(1);
  });
  it('can delete a job', () => {
    system.delete({ job: DUMMY });
    expect(system.getJobs()).toHaveLength(0);
  });
});