fix(registry): restore protocol routing and test coverage for npm, oci, and api flows
This commit is contained in:
@@ -13,16 +13,20 @@ import {
|
||||
get,
|
||||
post,
|
||||
setupTestDb,
|
||||
startTestServer,
|
||||
stopTestServer,
|
||||
teardownTestDb,
|
||||
} from '../helpers/index.ts';
|
||||
|
||||
describe('Auth API Integration', () => {
|
||||
describe('Auth API Integration', { sanitizeResources: false, sanitizeOps: false }, () => {
|
||||
beforeAll(async () => {
|
||||
await setupTestDb();
|
||||
await startTestServer();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await teardownTestDb();
|
||||
await stopTestServer();
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
@@ -56,7 +60,7 @@ describe('Auth API Integration', () => {
|
||||
|
||||
assertStatus(response, 401);
|
||||
const body = response.body as Record<string, unknown>;
|
||||
assertEquals(body.error, 'INVALID_CREDENTIALS');
|
||||
assertEquals(body.code, 'INVALID_CREDENTIALS');
|
||||
});
|
||||
|
||||
it('should return 401 for inactive user', async () => {
|
||||
@@ -72,7 +76,7 @@ describe('Auth API Integration', () => {
|
||||
|
||||
assertStatus(response, 401);
|
||||
const body = response.body as Record<string, unknown>;
|
||||
assertEquals(body.error, 'ACCOUNT_INACTIVE');
|
||||
assertEquals(body.code, 'ACCOUNT_INACTIVE');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -155,9 +159,14 @@ describe('Auth API Integration', () => {
|
||||
});
|
||||
const loginBody = loginResponse.body as Record<string, unknown>;
|
||||
const token = loginBody.accessToken as string;
|
||||
const sessionId = loginBody.sessionId as string;
|
||||
|
||||
// Logout
|
||||
const logoutResponse = await post('/api/v1/auth/logout', {}, createAuthHeader(token));
|
||||
// Logout with sessionId
|
||||
const logoutResponse = await post(
|
||||
'/api/v1/auth/logout',
|
||||
{ sessionId },
|
||||
createAuthHeader(token),
|
||||
);
|
||||
|
||||
assertStatus(logoutResponse, 200);
|
||||
|
||||
|
||||
@@ -16,19 +16,23 @@ import {
|
||||
post,
|
||||
put,
|
||||
setupTestDb,
|
||||
startTestServer,
|
||||
stopTestServer,
|
||||
teardownTestDb,
|
||||
} from '../helpers/index.ts';
|
||||
|
||||
describe('Organization API Integration', () => {
|
||||
describe('Organization API Integration', { sanitizeResources: false, sanitizeOps: false }, () => {
|
||||
let accessToken: string;
|
||||
let testUserId: string;
|
||||
|
||||
beforeAll(async () => {
|
||||
await setupTestDb();
|
||||
await startTestServer();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await teardownTestDb();
|
||||
await stopTestServer();
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
@@ -116,8 +120,8 @@ describe('Organization API Integration', () => {
|
||||
const response = await get('/api/v1/organizations', createAuthHeader(accessToken));
|
||||
|
||||
assertStatus(response, 200);
|
||||
const body = response.body as Record<string, unknown>[];
|
||||
assertEquals(body.length >= 2, true);
|
||||
const body = response.body as { organizations: Record<string, unknown>[] };
|
||||
assertEquals(body.organizations.length >= 2, true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -202,8 +206,8 @@ describe('Organization API Integration', () => {
|
||||
);
|
||||
|
||||
assertStatus(response, 200);
|
||||
const body = response.body as Record<string, unknown>[];
|
||||
assertEquals(body.length >= 1, true); // At least the creator
|
||||
const body = response.body as { members: Record<string, unknown>[] };
|
||||
assertEquals(body.members.length >= 1, true); // At least the creator
|
||||
});
|
||||
|
||||
it('should add member to organization', async () => {
|
||||
|
||||
Reference in New Issue
Block a user