import { isDevToolsEnabled } from '../config/devTools';

describe('Bulk-delete-all dev-tools gate logic', () => {
  const orig = process.env.REACT_APP_DEV_TOOLS;

  afterEach(() => {
    if (orig === undefined) delete process.env.REACT_APP_DEV_TOOLS;
    else process.env.REACT_APP_DEV_TOOLS = orig;
  });

  test('false when unset (safe default)', () => {
    delete process.env.REACT_APP_DEV_TOOLS;
    expect(isDevToolsEnabled()).toBe(false);
  });

  test('false when 0', () => {
    process.env.REACT_APP_DEV_TOOLS = '0';
    expect(isDevToolsEnabled()).toBe(false);
  });

  test('false when arbitrary string', () => {
    process.env.REACT_APP_DEV_TOOLS = 'true';
    expect(isDevToolsEnabled()).toBe(false);
  });

  test('true only when exactly 1', () => {
    process.env.REACT_APP_DEV_TOOLS = '1';
    expect(isDevToolsEnabled()).toBe(true);
  });
});
