Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/api/drizzle/0010_flashy_human_robot.sql

This file was deleted.

1 change: 0 additions & 1 deletion packages/api/drizzle/0033_add_avatar_url_to_users.sql

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ vi.mock('@packrat/api/services/catalogService', () => ({
})),
}));

describe('Generate From TikTok Routes', () => {
describe('Generate From Online Content Routes', () => {
beforeAll(async () => {
// Seed both a regular user and an admin user
await seedTestUser();
Expand All @@ -139,11 +139,11 @@ describe('Generate From TikTok Routes', () => {
});

describe('Authentication', () => {
it('requires auth for generate-from-tiktok endpoint', async () => {
it('requires auth for generate-from-online-content endpoint', async () => {
const res = await api(
'/pack-templates/generate-from-tiktok',
'/pack-templates/generate-from-online-content',
httpMethods.post('', {
tiktokUrl: 'https://www.tiktok.com/@user/video/1234567890',
contentUrl: 'https://www.tiktok.com/@user/video/1234567890',
}),
);
expectUnauthorized(res);
Expand All @@ -153,9 +153,9 @@ describe('Generate From TikTok Routes', () => {
describe('Authorization', () => {
it('returns 403 for non-admin users', async () => {
const res = await apiWithAuth(
'/pack-templates/generate-from-tiktok',
'/pack-templates/generate-from-online-content',
httpMethods.post('', {
tiktokUrl: 'https://www.tiktok.com/@user/video/1234567890',
contentUrl: 'https://www.tiktok.com/@user/video/1234567890',
}),
);

Expand All @@ -166,19 +166,19 @@ describe('Generate From TikTok Routes', () => {
});

describe('Request Validation', () => {
it('requires tiktokUrl field', async () => {
it('requires contentUrl field', async () => {
const res = await apiWithAdmin(
'/pack-templates/generate-from-tiktok',
'/pack-templates/generate-from-online-content',
httpMethods.post('', {}),
);
expectBadRequest(res);
});

it('requires valid URL format', async () => {
const res = await apiWithAdmin(
'/pack-templates/generate-from-tiktok',
'/pack-templates/generate-from-online-content',
httpMethods.post('', {
tiktokUrl: 'not-a-valid-url',
contentUrl: 'invalid-url',
}),
);
expectBadRequest(res);
Expand All @@ -200,9 +200,9 @@ describe('Generate From TikTok Routes', () => {
mockContainerFetch = createMockContainerFetch(duplicateContentId);

const res = await apiWithAdmin(
'/pack-templates/generate-from-tiktok',
'/pack-templates/generate-from-online-content',
httpMethods.post('', {
tiktokUrl: 'https://www.tiktok.com/@user/video/1234567890',
contentUrl: 'https://www.tiktok.com/@user/video/1234567890',
}),
);

Expand All @@ -214,12 +214,12 @@ describe('Generate From TikTok Routes', () => {
});
});

describe('POST /pack-templates/generate-from-tiktok', () => {
it('successfully generates template from TikTok URL', async () => {
describe('POST /pack-templates/generate-from-online-content', () => {
it('successfully generates template from online content URL', async () => {
const res = await apiWithAdmin(
'/pack-templates/generate-from-tiktok',
'/pack-templates/generate-from-online-content',
httpMethods.post('', {
tiktokUrl: 'https://www.tiktok.com/@user/video/9999999999',
contentUrl: 'https://www.tiktok.com/@user/video/9999999999',
}),
);

Expand All @@ -245,9 +245,9 @@ describe('Generate From TikTok Routes', () => {

it('accepts isAppTemplate flag', async () => {
const res = await apiWithAdmin(
'/pack-templates/generate-from-tiktok',
'/pack-templates/generate-from-online-content',
httpMethods.post('', {
tiktokUrl: 'https://www.tiktok.com/@user/video/6666666666',
contentUrl: 'https://www.tiktok.com/@user/video/temp-test',
isAppTemplate: false,
}),
);
Expand All @@ -259,9 +259,9 @@ describe('Generate From TikTok Routes', () => {

it('returns items with matched catalog data when available', async () => {
const res = await apiWithAdmin(
'/pack-templates/generate-from-tiktok',
'/pack-templates/generate-from-online-content',
httpMethods.post('', {
tiktokUrl: 'https://www.tiktok.com/@user/video/5555555555',
contentUrl: 'https://www.tiktok.com/@user/video/catalog-test',
}),
);

Expand Down
2 changes: 2 additions & 0 deletions packages/api/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export default defineWorkersConfig({
wrangler: { configPath: './wrangler.jsonc', environment: 'dev' },
},
},
// Only include integration tests from /test directory
include: [resolve(__dirname, 'test/**/*.test.ts')],
// Run tests sequentially to avoid database deadlocks
fileParallelism: false,
// Also disable parallel execution within test files
Expand Down
Loading