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);
  });
});
Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct