⚡ Zero-dependency plcbundle library exclusively for Bun
at main 1.6 kB view raw
1import { describe, test, expect } from 'bun:test'; 2import type { 3 BundleIndex, 4 BundleMetadata, 5 Operation, 6 ProcessStats, 7 CloneStats, 8 ProcessOptions, 9 CloneOptions, 10} from '../src/types'; 11 12describe('Type Definitions', () => { 13 test('BundleMetadata has required fields', () => { 14 const metadata: BundleMetadata = { 15 bundle_number: 1, 16 start_time: "2024-01-01T00:00:00.000Z", 17 end_time: "2024-01-01T01:00:00.000Z", 18 operation_count: 10000, 19 did_count: 9500, 20 hash: "abc123", 21 content_hash: "def456", 22 parent: "", 23 compressed_hash: "ghi789", 24 compressed_size: 1500000, 25 uncompressed_size: 5000000, 26 cursor: "", 27 created_at: "2024-01-01T02:00:00.000Z", 28 }; 29 30 expect(metadata.bundle_number).toBe(1); 31 expect(metadata.operation_count).toBe(10000); 32 }); 33 34 test('BundleIndex structure', () => { 35 const index: BundleIndex = { 36 version: "1.0", 37 last_bundle: 1, 38 updated_at: new Date().toISOString(), 39 total_size_bytes: 1000000, 40 bundles: [], 41 }; 42 43 expect(index.version).toBe("1.0"); 44 }); 45 46 test('ProcessStats structure', () => { 47 const stats: ProcessStats = { 48 totalOps: 100, 49 matchCount: 10, 50 totalBytes: 50000, 51 matchedBytes: 5000, 52 }; 53 54 expect(stats.totalOps).toBe(100); 55 }); 56 57 test('CloneStats structure', () => { 58 const stats: CloneStats = { 59 totalBundles: 100, 60 downloadedBundles: 50, 61 skippedBundles: 30, 62 failedBundles: 0, 63 totalBytes: 1000000, 64 downloadedBytes: 500000, 65 }; 66 67 expect(stats.totalBundles).toBe(100); 68 }); 69});