// Copyright 2017-2026 @pezkuwi/dev-test authors & contributors
// SPDX-License-Identifier: Apache-2.0

import '../globals.d.ts';

declare const describe: import('./suite.js').Describe;
declare const it: import('./suite.js').It;
declare const expect: (value: unknown) => { toBe: (expected: unknown) => void; toBeDefined: () => void };

describe('describe()', () => {
  // eslint-disable-next-line jest/no-focused-tests
  describe.only('.only', () => {
    it('runs this one', () => {
      expect(true).toBe(true);
    });
  });

  describe('.skip', () => {
    // eslint-disable-next-line jest/no-disabled-tests
    describe.skip('.only (.skip)', () => {
      it('skips inside .only', () => {
        expect(true).toBe(true);

        throw new Error('FATAL: This should not run');
      });
    });
  });
});

describe('it()', () => {
  it('has been enhanced', () => {
    expect(it.todo).toBeDefined();
  });

  it('allows promises', async () => {
    expect(await Promise.resolve(true)).toBe(true);
  });

  describe('.only', () => {
    // eslint-disable-next-line jest/no-focused-tests
    it.only('runs this test when .only is used', () => {
      expect(true).toBe(true);
    });

    // eslint-disable-next-line jest/no-disabled-tests
    it.skip('skips when .skip is used', () => {
      expect(true).toBe(true);

      throw new Error('FATAL: This should not run');
    });
  });

  describe('.skip', () => {
    // eslint-disable-next-line jest/no-disabled-tests
    it.skip('skips when .skip is used', () => {
      expect(true).toBe(true);

      throw new Error('FATAL: This should not run');
    });
  });

  describe('.todo', () => {
    it.todo('marks as a todo when .todo is used', () => {
      expect(true).toBe(true);
    });
  });
});
