feat: add number library routing and cdr location support
This commit is contained in:
@@ -5,6 +5,7 @@ import { join } from 'node:path';
|
||||
const schema = readFileSync(join(process.cwd(), 'prisma/schema.prisma'), 'utf8');
|
||||
const migration = readFileSync(join(process.cwd(), 'prisma/migrations/20260621090000_init_v2_schema/migration.sql'), 'utf8');
|
||||
const authMigration = readFileSync(join(process.cwd(), 'prisma/migrations/20260621093000_auth_sessions/migration.sql'), 'utf8');
|
||||
const numberLibraryMigration = readFileSync(join(process.cwd(), 'prisma/migrations/20260624095000_number_library/migration.sql'), 'utf8');
|
||||
|
||||
describe('Prisma schema contract', () => {
|
||||
it('defines every V2 core business table', () => {
|
||||
@@ -16,11 +17,16 @@ describe('Prisma schema contract', () => {
|
||||
'vendors',
|
||||
'vendor_recharges',
|
||||
'vendor_gateways',
|
||||
'vendor_gateway_blocked_regions',
|
||||
'vendor_gateway_forbidden_periods',
|
||||
'vendor_gateway_codecs',
|
||||
'vendor_gateway_prefix_rules',
|
||||
'landing_line_groups',
|
||||
'landing_line_group_items',
|
||||
'geo_cities',
|
||||
'phone_number_segments',
|
||||
'phone_area_codes',
|
||||
'carrier_prefix_rules',
|
||||
'raw_cdrs',
|
||||
'rated_cdrs',
|
||||
'recordings',
|
||||
@@ -39,7 +45,7 @@ describe('Prisma schema contract', () => {
|
||||
|
||||
for (const table of tables) {
|
||||
expect(schema).toContain(`@@map("${table}")`);
|
||||
expect(`${migration}\n${authMigration}`).toContain(`CREATE TABLE \`${table}\``);
|
||||
expect(`${migration}\n${authMigration}\n${numberLibraryMigration}`).toContain(`CREATE TABLE \`${table}\``);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -52,6 +58,16 @@ describe('Prisma schema contract', () => {
|
||||
expect(migration).toContain('UNIQUE INDEX `idempotency_keys_key_key`');
|
||||
});
|
||||
|
||||
it('captures number library and CDR callee attribution fields', () => {
|
||||
expect(schema).toContain('model GeoCity');
|
||||
expect(schema).toContain('model PhoneNumberSegment');
|
||||
expect(schema).toContain('model CarrierPrefixRule');
|
||||
expect(numberLibraryMigration).toContain('`segment7` CHAR(7) NOT NULL');
|
||||
expect(numberLibraryMigration).toContain('`callee_city_code` VARCHAR(12) NULL');
|
||||
expect(numberLibraryMigration).toContain('`callee_operator` ENUM');
|
||||
expect(numberLibraryMigration).toContain('CREATE INDEX `raw_cdrs_callee_operator_started_at_idx`');
|
||||
});
|
||||
|
||||
it('models audit columns and outbox publishing state', () => {
|
||||
expect(schema).toContain('createdAt');
|
||||
expect(schema).toContain('updatedAt');
|
||||
|
||||
Reference in New Issue
Block a user