This commit is contained in:
2025-12-12 21:39:48 +01:00
parent ddbd99b747
commit cae81b1088
49 changed files with 777 additions and 269 deletions

View File

@@ -9,12 +9,12 @@ describe('getAppMode', () => {
beforeEach(() => {
process.env = { ...originalEnv };
process.env.NODE_ENV = 'production';
(process.env as any).NODE_ENV = 'production';
});
afterEach(() => {
process.env = originalEnv;
process.env.NODE_ENV = ORIGINAL_NODE_ENV;
(process.env as any).NODE_ENV = ORIGINAL_NODE_ENV;
});
it('returns "pre-launch" when NEXT_PUBLIC_GRIDPILOT_MODE is undefined', () => {
@@ -55,7 +55,7 @@ describe('getAppMode', () => {
});
it('throws in development when NEXT_PUBLIC_GRIDPILOT_MODE is invalid', () => {
process.env.NODE_ENV = 'development';
(process.env as any).NODE_ENV = 'development';
process.env.NEXT_PUBLIC_GRIDPILOT_MODE = 'invalid-mode';
expect(() => getAppMode()).toThrowError(/Invalid NEXT_PUBLIC_GRIDPILOT_MODE/);

View File

@@ -77,7 +77,7 @@ describe('/api/signup POST', () => {
const data = (await response.json()) as { error: unknown };
expect(typeof data.error).toBe('string');
expect(data.error.toLowerCase()).toContain('email');
expect(typeof data.error === 'string' && data.error.toLowerCase()).toContain('email');
});
it('rejects disposable email domains with 400 and error message', async () => {
@@ -110,7 +110,7 @@ describe('/api/signup POST', () => {
const data = (await second.json()) as { error: unknown };
expect(typeof data.error).toBe('string');
expect(data.error.toLowerCase()).toContain('already');
expect(typeof data.error === 'string' && data.error.toLowerCase()).toContain('already');
});
it('returns 429 with retryAfter when rate limit is exceeded', async () => {