Spaces:
Running
Running
File size: 694 Bytes
3e8ea5d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import { GET } from './route';
import assert from 'node:assert/strict';
import { afterEach, describe, it } from 'node:test';
const originalAppPassword = process.env.APP_PASSWORD;
afterEach(() => {
if (originalAppPassword === undefined) {
delete process.env.APP_PASSWORD;
} else {
process.env.APP_PASSWORD = originalAppPassword;
}
});
describe('GET /api/auth-status', () => {
it('treats blank APP_PASSWORD as disabled', async () => {
process.env.APP_PASSWORD = ' ';
const response = await GET();
const body = (await response.json()) as { passwordRequired?: boolean };
assert.equal(body.passwordRequired, false);
});
});
|