File size: 4,432 Bytes
ceb943f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import { describe, it, expect } from 'vitest';
import * as schema from '../schema';

describe('Database Schema - YouTube Channels', () => {
    it('should have youtubeChannels table defined with correct columns', () => {
        expect(schema.youtubeChannels).toBeDefined();
        expect(schema.youtubeChannels.channelId).toBeDefined();
        expect(schema.youtubeChannels.syncStatus).toBeDefined();
    });

    it('should have sync_status enum defined', () => {
        expect(schema.syncStatusEnum).toBeDefined();
        expect(schema.syncStatusEnum.enumValues).toContain('idle');
        expect(schema.syncStatusEnum.enumValues).toContain('syncing');
        expect(schema.syncStatusEnum.enumValues).toContain('errored');
    });
});

describe('Database Schema - Detected Objects', () => {
    it('should have detectedObjects table defined with correct columns', () => {

        expect(schema.detectedObjects).toBeDefined();

        expect(schema.detectedObjects.category).toBeDefined();

        expect(schema.detectedObjects.status).toBeDefined();

        expect(schema.detectedObjects.confidenceScore).toBeDefined();
        expect(schema.detectedObjects.moderationStatus).toBeDefined();
        expect(schema.detectedObjects.moderatedAt).toBeDefined();
        expect(schema.detectedObjects.moderatedBy).toBeDefined();
        expect(schema.detectedObjects.moderationMetadata).toBeDefined();
    });

    it('should have object_category enum defined', () => {

        expect(schema.objectCategory).toBeDefined();

        expect(schema.objectCategory.enumValues).toContain('Tech');

        expect(schema.objectCategory.enumValues).toContain('Fashion');
    });

    it('should have detection_status enum defined', () => {

        expect(schema.detectionStatus).toBeDefined();

        expect(schema.detectionStatus.enumValues).toContain('pending_review');

        expect(schema.detectionStatus.enumValues).toContain('flagged');
    });

    it('should have moderation_status enum defined', () => {
        expect(schema.moderationStatus).toBeDefined();
        expect(schema.moderationStatus.enumValues).toContain('PENDING');
        expect(schema.moderationStatus.enumValues).toContain('APPROVED');
        expect(schema.moderationStatus.enumValues).toContain('REJECTED');
    });
});
describe('Database Schema - Marketplace Matches', () => {
    it('should have marketplaceMatches table defined with correct columns', () => {
        expect(schema.marketplaceMatches).toBeDefined();
        expect(schema.marketplaceMatches.marketplace).toBeDefined();
        expect(schema.marketplaceMatches.availabilityStatus).toBeDefined();
        expect(schema.marketplaceMatches.price).toBeDefined();
    });

    it('should have marketplace_type enum defined', () => {
        expect(schema.marketplaceType).toBeDefined();
        expect(schema.marketplaceType.enumValues).toContain('amazon');
        expect(schema.marketplaceType.enumValues).toContain('ebay');
        expect(schema.marketplaceType.enumValues).toContain('etsy');
    });

    it('should have availability_status enum defined', () => {
        expect(schema.availabilityStatus).toBeDefined();
        expect(schema.availabilityStatus.enumValues).toContain('IN_STOCK');
        expect(schema.availabilityStatus.enumValues).toContain('SOLD_OUT');
        expect(schema.availabilityStatus.enumValues).toContain('DISCONTINUED');
    });
});
describe('Database Schema - Admin Moderation', () => {
    it('should have adminModeration table defined with correct columns', () => {
        expect(schema.adminModeration).toBeDefined();
        expect(schema.adminModeration.detectionId).toBeDefined();
        expect(schema.adminModeration.adminId).toBeDefined();
        expect(schema.adminModeration.action).toBeDefined();
        expect(schema.adminModeration.originalValues).toBeDefined();
    });

    it('should have admin_moderation_type enum defined', () => {
        expect(schema.adminModerationType).toBeDefined();
        expect(schema.adminModerationType.enumValues).toContain('corrected');
        expect(schema.adminModerationType.enumValues).toContain('marked_incorrect');
    });

    it('should have reason_code enum defined', () => {
        expect(schema.reasonCode).toBeDefined();
        expect(schema.reasonCode.enumValues).toContain('wrong_object');
        expect(schema.reasonCode.enumValues).toContain('false_positive');
    });
});