.ai/principles/baselines/testing-jest.md
Follow BDD (Behaviour-Driven Development) conventions: use describe blocks to define the context or state the system is in, it blocks to declare the specific behaviour being verified, and beforeEach to set up shared state. Group related tests together under a shared describe block.
// Bad
it('does Y when X', () => { ... })
// Good
describe('when X', () => {
beforeEach(() => { /* set up X */ });
it('does Y', () => { ... });
});
app/assets/javascripts/lib/utils/path_helpers or ee/app/assets/javascripts/lib/utils/path_helpers in Jest tests. You can assume that gon.current_organization.has_scoped_paths will be false and that window.gon?.relative_url_root will be '' in Jest tests. There may be existing tests for the relative_url_root functionality, for these you can use useConfigurePathHelpers in spec/frontend/__helpers__/configure_path_helpers.js.