@skillsmith/core 0.6.3 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/CHANGELOG.md +22 -1
  2. package/README.md +18 -0
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/src/api/client.d.ts.map +1 -1
  5. package/dist/src/api/client.events.d.ts.map +1 -1
  6. package/dist/src/api/client.events.js +10 -1
  7. package/dist/src/api/client.events.js.map +1 -1
  8. package/dist/src/api/client.health.d.ts.map +1 -1
  9. package/dist/src/api/client.health.js +7 -1
  10. package/dist/src/api/client.health.js.map +1 -1
  11. package/dist/src/api/client.js +11 -1
  12. package/dist/src/api/client.js.map +1 -1
  13. package/dist/src/api/utils.d.ts +14 -3
  14. package/dist/src/api/utils.d.ts.map +1 -1
  15. package/dist/src/api/utils.js +14 -4
  16. package/dist/src/api/utils.js.map +1 -1
  17. package/dist/src/exports/services.d.ts +0 -1
  18. package/dist/src/exports/services.d.ts.map +1 -1
  19. package/dist/src/exports/services.js +14 -3
  20. package/dist/src/exports/services.js.map +1 -1
  21. package/dist/src/index.d.ts +2 -1
  22. package/dist/src/index.d.ts.map +1 -1
  23. package/dist/src/index.js +4 -1
  24. package/dist/src/index.js.map +1 -1
  25. package/dist/src/types.d.ts +12 -0
  26. package/dist/src/types.d.ts.map +1 -1
  27. package/dist/tests/api/client.auth.test.js +50 -0
  28. package/dist/tests/api/client.auth.test.js.map +1 -1
  29. package/dist/tests/api/utils.test.js +7 -3
  30. package/dist/tests/api/utils.test.js.map +1 -1
  31. package/dist/tests/{billing/stripe-validators.test.d.ts → security/sanitization-stripe-ids.test.d.ts} +1 -1
  32. package/dist/tests/security/sanitization-stripe-ids.test.d.ts.map +1 -0
  33. package/dist/tests/{billing/stripe-validators.test.js → security/sanitization-stripe-ids.test.js} +1 -1
  34. package/dist/tests/security/sanitization-stripe-ids.test.js.map +1 -0
  35. package/dist/tests/shared.test.js.map +1 -1
  36. package/package.json +2 -8
  37. package/dist/src/billing/BillingService.d.ts +0 -101
  38. package/dist/src/billing/BillingService.d.ts.map +0 -1
  39. package/dist/src/billing/BillingService.helpers.d.ts +0 -15
  40. package/dist/src/billing/BillingService.helpers.d.ts.map +0 -1
  41. package/dist/src/billing/BillingService.helpers.js +0 -45
  42. package/dist/src/billing/BillingService.helpers.js.map +0 -1
  43. package/dist/src/billing/BillingService.js +0 -263
  44. package/dist/src/billing/BillingService.js.map +0 -1
  45. package/dist/src/billing/BillingService.types.d.ts +0 -52
  46. package/dist/src/billing/BillingService.types.d.ts.map +0 -1
  47. package/dist/src/billing/BillingService.types.js +0 -6
  48. package/dist/src/billing/BillingService.types.js.map +0 -1
  49. package/dist/src/billing/GDPRComplianceService.d.ts +0 -81
  50. package/dist/src/billing/GDPRComplianceService.d.ts.map +0 -1
  51. package/dist/src/billing/GDPRComplianceService.js +0 -361
  52. package/dist/src/billing/GDPRComplianceService.js.map +0 -1
  53. package/dist/src/billing/StripeClient.d.ts +0 -119
  54. package/dist/src/billing/StripeClient.d.ts.map +0 -1
  55. package/dist/src/billing/StripeClient.js +0 -405
  56. package/dist/src/billing/StripeClient.js.map +0 -1
  57. package/dist/src/billing/StripeReconciliationJob.d.ts +0 -50
  58. package/dist/src/billing/StripeReconciliationJob.d.ts.map +0 -1
  59. package/dist/src/billing/StripeReconciliationJob.js +0 -365
  60. package/dist/src/billing/StripeReconciliationJob.js.map +0 -1
  61. package/dist/src/billing/StripeWebhookHandler.d.ts +0 -49
  62. package/dist/src/billing/StripeWebhookHandler.d.ts.map +0 -1
  63. package/dist/src/billing/StripeWebhookHandler.js +0 -162
  64. package/dist/src/billing/StripeWebhookHandler.js.map +0 -1
  65. package/dist/src/billing/gdpr-types.d.ts +0 -103
  66. package/dist/src/billing/gdpr-types.d.ts.map +0 -1
  67. package/dist/src/billing/gdpr-types.js +0 -7
  68. package/dist/src/billing/gdpr-types.js.map +0 -1
  69. package/dist/src/billing/index.d.ts +0 -18
  70. package/dist/src/billing/index.d.ts.map +0 -1
  71. package/dist/src/billing/index.js +0 -19
  72. package/dist/src/billing/index.js.map +0 -1
  73. package/dist/src/billing/reconciliation-helpers.d.ts +0 -16
  74. package/dist/src/billing/reconciliation-helpers.d.ts.map +0 -1
  75. package/dist/src/billing/reconciliation-helpers.js +0 -53
  76. package/dist/src/billing/reconciliation-helpers.js.map +0 -1
  77. package/dist/src/billing/reconciliation-types.d.ts +0 -71
  78. package/dist/src/billing/reconciliation-types.d.ts.map +0 -1
  79. package/dist/src/billing/reconciliation-types.js +0 -7
  80. package/dist/src/billing/reconciliation-types.js.map +0 -1
  81. package/dist/src/billing/stripe-client-types.d.ts +0 -45
  82. package/dist/src/billing/stripe-client-types.d.ts.map +0 -1
  83. package/dist/src/billing/stripe-client-types.js +0 -7
  84. package/dist/src/billing/stripe-client-types.js.map +0 -1
  85. package/dist/src/billing/stripe-helpers.d.ts +0 -17
  86. package/dist/src/billing/stripe-helpers.d.ts.map +0 -1
  87. package/dist/src/billing/stripe-helpers.js +0 -50
  88. package/dist/src/billing/stripe-helpers.js.map +0 -1
  89. package/dist/src/billing/types.d.ts +0 -266
  90. package/dist/src/billing/types.d.ts.map +0 -1
  91. package/dist/src/billing/types.js +0 -23
  92. package/dist/src/billing/types.js.map +0 -1
  93. package/dist/src/billing/webhook-handlers.d.ts +0 -56
  94. package/dist/src/billing/webhook-handlers.d.ts.map +0 -1
  95. package/dist/src/billing/webhook-handlers.js +0 -303
  96. package/dist/src/billing/webhook-handlers.js.map +0 -1
  97. package/dist/src/billing/webhook-types.d.ts +0 -42
  98. package/dist/src/billing/webhook-types.d.ts.map +0 -1
  99. package/dist/src/billing/webhook-types.js +0 -7
  100. package/dist/src/billing/webhook-types.js.map +0 -1
  101. package/dist/tests/billing/BillingService.test.d.ts +0 -7
  102. package/dist/tests/billing/BillingService.test.d.ts.map +0 -1
  103. package/dist/tests/billing/BillingService.test.js +0 -168
  104. package/dist/tests/billing/BillingService.test.js.map +0 -1
  105. package/dist/tests/billing/GDPRCompliance.test.d.ts +0 -7
  106. package/dist/tests/billing/GDPRCompliance.test.d.ts.map +0 -1
  107. package/dist/tests/billing/GDPRCompliance.test.js +0 -380
  108. package/dist/tests/billing/GDPRCompliance.test.js.map +0 -1
  109. package/dist/tests/billing/StripeClient.test.d.ts +0 -18
  110. package/dist/tests/billing/StripeClient.test.d.ts.map +0 -1
  111. package/dist/tests/billing/StripeClient.test.js +0 -566
  112. package/dist/tests/billing/StripeClient.test.js.map +0 -1
  113. package/dist/tests/billing/StripeReconciliation.test.d.ts +0 -7
  114. package/dist/tests/billing/StripeReconciliation.test.d.ts.map +0 -1
  115. package/dist/tests/billing/StripeReconciliation.test.js +0 -266
  116. package/dist/tests/billing/StripeReconciliation.test.js.map +0 -1
  117. package/dist/tests/billing/StripeWebhookHandler.test.d.ts +0 -16
  118. package/dist/tests/billing/StripeWebhookHandler.test.d.ts.map +0 -1
  119. package/dist/tests/billing/StripeWebhookHandler.test.js +0 -240
  120. package/dist/tests/billing/StripeWebhookHandler.test.js.map +0 -1
  121. package/dist/tests/billing/stripe-helpers.test.d.ts +0 -7
  122. package/dist/tests/billing/stripe-helpers.test.d.ts.map +0 -1
  123. package/dist/tests/billing/stripe-helpers.test.js +0 -91
  124. package/dist/tests/billing/stripe-helpers.test.js.map +0 -1
  125. package/dist/tests/billing/stripe-validators.test.d.ts.map +0 -1
  126. package/dist/tests/billing/stripe-validators.test.js.map +0 -1
  127. package/dist/tests/billing/webhook-handlers.test.d.ts +0 -16
  128. package/dist/tests/billing/webhook-handlers.test.d.ts.map +0 -1
  129. package/dist/tests/billing/webhook-handlers.test.js +0 -519
  130. package/dist/tests/billing/webhook-handlers.test.js.map +0 -1
@@ -1,380 +0,0 @@
1
- /**
2
- * SMI-1068: GDPR Compliance Tests
3
- * SMI-4286: Absorbed unique assertions from the deleted mock-chain duplicate
4
- * (src/billing/GDPRComplianceService.test.ts) into this integration suite.
5
- */
6
- import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
7
- import { createDatabaseSync } from '../../src/db/createDatabase.js';
8
- import { GDPRComplianceService } from '../../src/billing/GDPRComplianceService.js';
9
- import { initializeAnalyticsSchema } from '../../src/analytics/schema.js';
10
- import { randomUUID } from 'crypto';
11
- /**
12
- * Build a minimal Stripe client double exposing `getStripeInstance().customers.del()`.
13
- * Pass a custom `deletesFn` (e.g. `vi.fn().mockRejectedValue(...)`) to exercise
14
- * Stripe error paths. The default resolves successfully.
15
- */
16
- function makeMockStripe(deletesFn = vi.fn().mockResolvedValue({})) {
17
- return {
18
- getStripeInstance: vi.fn().mockReturnValue({
19
- customers: { del: deletesFn },
20
- }),
21
- };
22
- }
23
- describe('GDPRComplianceService', () => {
24
- let db;
25
- let gdprService;
26
- beforeEach(() => {
27
- db = createDatabaseSync(':memory:');
28
- initializeAnalyticsSchema(db);
29
- gdprService = new GDPRComplianceService({ db });
30
- // Suppress expected logger.error output during DB-throw / Stripe-error tests.
31
- // Do NOT spy on createLogger()'s return — the service holds its own module-level
32
- // instance. Spy on console.error (the logger's ultimate sink) instead.
33
- vi.spyOn(console, 'error').mockImplementation(() => { });
34
- });
35
- afterEach(() => {
36
- vi.restoreAllMocks();
37
- db.close();
38
- });
39
- function insertSubscription(customerId, opts = {}) {
40
- const subId = opts.subscriptionId ?? randomUUID();
41
- const now = new Date().toISOString();
42
- const seat = opts.seatCount === undefined ? 5 : opts.seatCount;
43
- const stmt = db.prepare(`INSERT INTO user_subscriptions (
44
- id, customer_id, email, stripe_customer_id, stripe_subscription_id,
45
- stripe_price_id, tier, status, seat_count,
46
- current_period_start, current_period_end, created_at, updated_at
47
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
48
- const args = [
49
- subId, customerId, 'test@example.com', `cus_${customerId}`, `sub_${customerId}`,
50
- 'price_test', opts.tier ?? 'team', 'active', seat, now, now, now, now,
51
- ]; // prettier-ignore
52
- stmt.run(...args);
53
- return subId;
54
- }
55
- function createTestCustomer(customerId) {
56
- const subId = insertSubscription(customerId);
57
- const now = new Date().toISOString();
58
- const invStmt = db.prepare(`INSERT INTO invoices (
59
- id, customer_id, stripe_invoice_id, subscription_id,
60
- amount_cents, currency, status, invoice_number, created_at
61
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`);
62
- const invArgs = [randomUUID(), customerId, `in_${customerId}`, subId, 2500, 'usd', 'paid', 'INV-001', now]; // prettier-ignore
63
- invStmt.run(...invArgs);
64
- const licenseKeyId = randomUUID();
65
- const keyStmt = db.prepare(`INSERT INTO license_keys (
66
- id, subscription_id, organization_id, key_jwt, key_hash,
67
- key_expiry, is_active, generated_at
68
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`);
69
- const keyArgs = [licenseKeyId, subId, customerId, `test.jwt.token.${customerId}`, `hash_${customerId}_${licenseKeyId}`, now, 1, now]; // prettier-ignore
70
- keyStmt.run(...keyArgs);
71
- const whStmt = db.prepare(`INSERT INTO stripe_webhook_events (
72
- id, stripe_event_id, event_type, processed_at,
73
- payload, success, created_at
74
- ) VALUES (?, ?, ?, ?, ?, ?, ?)`);
75
- const whArgs = [randomUUID(), `evt_${customerId}`, 'customer.subscription.created', now, JSON.stringify({ customer: `cus_${customerId}` }), 1, now]; // prettier-ignore
76
- whStmt.run(...whArgs);
77
- return subId;
78
- }
79
- describe('Data Export (Article 20)', () => {
80
- it('should export all customer data', () => {
81
- const customerId = 'test_customer_123';
82
- createTestCustomer(customerId);
83
- const exportData = gdprService.exportCustomerData(customerId);
84
- expect(exportData.metadata.customerId).toBe(customerId);
85
- expect(exportData.metadata.format).toBe('json');
86
- expect(exportData.metadata.version).toBe('1.0');
87
- expect(exportData.metadata.exportedAt).toBeDefined();
88
- });
89
- it('should export subscription data', () => {
90
- const customerId = 'test_customer_123';
91
- createTestCustomer(customerId);
92
- const exportData = gdprService.exportCustomerData(customerId);
93
- expect(exportData.subscriptions).toHaveLength(1);
94
- expect(exportData.subscriptions[0].tier).toBe('team');
95
- expect(exportData.subscriptions[0].status).toBe('active');
96
- expect(exportData.subscriptions[0].seatCount).toBe(5);
97
- });
98
- it('should export invoice data', () => {
99
- const customerId = 'test_customer_123';
100
- createTestCustomer(customerId);
101
- const exportData = gdprService.exportCustomerData(customerId);
102
- expect(exportData.invoices).toHaveLength(1);
103
- expect(exportData.invoices[0].amountCents).toBe(2500);
104
- expect(exportData.invoices[0].currency).toBe('usd');
105
- expect(exportData.invoices[0].status).toBe('paid');
106
- });
107
- it('should export license key data without the actual JWT', () => {
108
- const customerId = 'test_customer_123';
109
- createTestCustomer(customerId);
110
- const exportData = gdprService.exportCustomerData(customerId);
111
- expect(exportData.licenseKeys).toHaveLength(1);
112
- expect(exportData.licenseKeys[0].isActive).toBe(true);
113
- const keyData = exportData.licenseKeys[0];
114
- expect(keyData['keyJwt']).toBeUndefined();
115
- expect(keyData['keyHash']).toBeUndefined();
116
- });
117
- it('should export webhook events', () => {
118
- const customerId = 'test_customer_123';
119
- createTestCustomer(customerId);
120
- const exportData = gdprService.exportCustomerData(customerId);
121
- expect(exportData.webhookEvents).toHaveLength(1);
122
- expect(exportData.webhookEvents[0].eventType).toBe('customer.subscription.created');
123
- expect(exportData.webhookEvents[0].success).toBe(true);
124
- });
125
- it('should return empty arrays for non-existent customer', () => {
126
- const exportData = gdprService.exportCustomerData('non_existent');
127
- expect(exportData.subscriptions).toHaveLength(0);
128
- expect(exportData.invoices).toHaveLength(0);
129
- expect(exportData.licenseKeys).toHaveLength(0);
130
- expect(exportData.webhookEvents).toHaveLength(0);
131
- });
132
- });
133
- describe('Data Export (Article 20) — metadata', () => {
134
- it('should return metadata with format=json and version=1.0', () => {
135
- const customerId = 'metadata_customer_1';
136
- createTestCustomer(customerId);
137
- const exportData = gdprService.exportCustomerData(customerId);
138
- expect(exportData.metadata.format).toBe('json');
139
- expect(exportData.metadata.version).toBe('1.0');
140
- });
141
- it('should default seatCount to 1 when subscription row has seatCount=NULL', () => {
142
- const customerId = 'metadata_customer_null_seat';
143
- insertSubscription(customerId, { tier: 'individual', seatCount: null });
144
- const exportData = gdprService.exportCustomerData(customerId);
145
- expect(exportData.subscriptions).toHaveLength(1);
146
- expect(exportData.subscriptions[0].seatCount).toBe(1);
147
- });
148
- it('should include an ISO-8601 exportedAt timestamp', () => {
149
- const customerId = 'metadata_customer_iso';
150
- createTestCustomer(customerId);
151
- const exportData = gdprService.exportCustomerData(customerId);
152
- expect(exportData.metadata.exportedAt).toMatch(/^\d{4}-\d{2}-\d{2}T/);
153
- });
154
- });
155
- describe('Data Deletion (Article 17) — happy path', () => {
156
- it('should delete all customer data', async () => {
157
- const customerId = 'test_customer_123';
158
- createTestCustomer(customerId);
159
- expect(gdprService.hasCustomerData(customerId)).toBe(true);
160
- const result = await gdprService.deleteCustomerData(customerId, {
161
- deleteFromStripe: false,
162
- });
163
- expect(result.success).toBe(true);
164
- expect(result.customerId).toBe(customerId);
165
- expect(result.counts.subscriptions).toBe(1);
166
- expect(result.counts.invoices).toBe(1);
167
- expect(result.counts.licenseKeys).toBe(1);
168
- expect(result.counts.webhookEvents).toBe(1);
169
- });
170
- it('should perform cascading deletion in correct order', async () => {
171
- const customerId = 'test_customer_123';
172
- createTestCustomer(customerId);
173
- await gdprService.deleteCustomerData(customerId, { deleteFromStripe: false });
174
- expect(gdprService.hasCustomerData(customerId)).toBe(false);
175
- const invoices = db.prepare(`SELECT id FROM invoices WHERE customer_id = ?`).all(customerId);
176
- expect(invoices).toHaveLength(0);
177
- });
178
- it('should support dry run mode', async () => {
179
- const customerId = 'test_customer_123';
180
- createTestCustomer(customerId);
181
- const result = await gdprService.deleteCustomerData(customerId, {
182
- deleteFromStripe: false,
183
- dryRun: true,
184
- });
185
- expect(result.counts.subscriptions).toBe(1);
186
- expect(result.counts.invoices).toBe(1);
187
- expect(result.counts.licenseKeys).toBe(1);
188
- expect(gdprService.hasCustomerData(customerId)).toBe(true);
189
- });
190
- it('should handle deletion of non-existent customer', async () => {
191
- const result = await gdprService.deleteCustomerData('non_existent', {
192
- deleteFromStripe: false,
193
- });
194
- expect(result.success).toBe(true);
195
- expect(result.counts.subscriptions).toBe(0);
196
- expect(result.counts.invoices).toBe(0);
197
- });
198
- it('should delete multiple customers independently', async () => {
199
- const customer1 = 'test_customer_1';
200
- const customer2 = 'test_customer_2';
201
- createTestCustomer(customer1);
202
- createTestCustomer(customer2);
203
- await gdprService.deleteCustomerData(customer1, { deleteFromStripe: false });
204
- expect(gdprService.hasCustomerData(customer1)).toBe(false);
205
- expect(gdprService.hasCustomerData(customer2)).toBe(true);
206
- });
207
- });
208
- describe('Data Deletion (Article 17) — error paths', () => {
209
- it('should rollback and report error when a DELETE throws', async () => {
210
- const customerId = 'error_path_customer_1';
211
- createTestCustomer(customerId);
212
- // Capture originalPrepare before the spy — spy impl delegates for other SQL.
213
- const originalPrepare = db.prepare.bind(db);
214
- vi.spyOn(db, 'prepare').mockImplementation((sql) => {
215
- if (typeof sql === 'string' && sql.includes('DELETE FROM invoices')) {
216
- throw new Error('disk I/O error');
217
- }
218
- return originalPrepare(sql);
219
- });
220
- const result = await gdprService.deleteCustomerData(customerId, {
221
- deleteFromStripe: false,
222
- });
223
- expect(result.success).toBe(false);
224
- expect(result.errors).toHaveLength(1);
225
- expect(result.errors[0]).toContain('disk I/O error');
226
- // Restore prepare so we can verify data is intact (rollback worked).
227
- vi.restoreAllMocks();
228
- vi.spyOn(console, 'error').mockImplementation(() => { });
229
- expect(gdprService.hasCustomerData(customerId)).toBe(true);
230
- const invoices = db.prepare(`SELECT id FROM invoices WHERE customer_id = ?`).all(customerId);
231
- expect(invoices).toHaveLength(1);
232
- });
233
- it('should capture Stripe deletion error in errors without failing db deletion', async () => {
234
- const customerId = 'error_path_customer_2';
235
- createTestCustomer(customerId);
236
- const stripeDel = vi.fn().mockRejectedValue(new Error('Stripe unavailable'));
237
- const serviceWithStripe = new GDPRComplianceService({
238
- db,
239
- stripeClient: makeMockStripe(stripeDel),
240
- });
241
- const result = await serviceWithStripe.deleteCustomerData(customerId);
242
- // DB deletion should have succeeded — customer data is gone.
243
- expect(gdprService.hasCustomerData(customerId)).toBe(false);
244
- expect(result.counts.subscriptions).toBe(1);
245
- expect(result.counts.invoices).toBe(1);
246
- // Stripe error is captured but db deletion is not undone.
247
- expect(result.errors).toHaveLength(1);
248
- expect(result.errors[0]).toContain('Stripe unavailable');
249
- expect(result.stripeDeleted).toBe(false);
250
- expect(result.success).toBe(false);
251
- });
252
- it('should report both errors when DB and Stripe both fail', async () => {
253
- const customerId = 'error_path_customer_3';
254
- createTestCustomer(customerId);
255
- const originalPrepare = db.prepare.bind(db);
256
- vi.spyOn(db, 'prepare').mockImplementation((sql) => {
257
- if (typeof sql === 'string' && sql.includes('DELETE FROM invoices')) {
258
- throw new Error('disk I/O error');
259
- }
260
- return originalPrepare(sql);
261
- });
262
- const stripeDel = vi.fn().mockRejectedValue(new Error('Stripe unavailable'));
263
- const serviceWithStripe = new GDPRComplianceService({
264
- db,
265
- stripeClient: makeMockStripe(stripeDel),
266
- });
267
- const result = await serviceWithStripe.deleteCustomerData(customerId);
268
- expect(result.success).toBe(false);
269
- expect(result.stripeDeleted).toBe(false);
270
- expect(result.errors).toHaveLength(2);
271
- expect(result.errors.some((e) => e.includes('disk I/O error'))).toBe(true);
272
- expect(result.errors.some((e) => e.includes('Stripe unavailable'))).toBe(true);
273
- });
274
- });
275
- describe('Data Deletion (Article 17) — stripe flag semantics', () => {
276
- it('should set stripeDeleted=true after successful Stripe deletion', async () => {
277
- const customerId = 'stripe_flag_customer_1';
278
- createTestCustomer(customerId);
279
- const stripeDel = vi.fn().mockResolvedValue({});
280
- const serviceWithStripe = new GDPRComplianceService({
281
- db,
282
- stripeClient: makeMockStripe(stripeDel),
283
- });
284
- const result = await serviceWithStripe.deleteCustomerData(customerId);
285
- expect(result.stripeDeleted).toBe(true);
286
- expect(stripeDel).toHaveBeenCalledWith(`cus_${customerId}`);
287
- expect(result.success).toBe(true);
288
- expect(result.errors).toEqual([]);
289
- });
290
- it('should set stripeDeleted=false on Stripe error', async () => {
291
- const customerId = 'stripe_flag_customer_2';
292
- createTestCustomer(customerId);
293
- const stripeDel = vi.fn().mockRejectedValue(new Error('network error'));
294
- const serviceWithStripe = new GDPRComplianceService({
295
- db,
296
- stripeClient: makeMockStripe(stripeDel),
297
- });
298
- const result = await serviceWithStripe.deleteCustomerData(customerId);
299
- expect(result.stripeDeleted).toBe(false);
300
- });
301
- it('should skip Stripe client call when deleteFromStripe=false', async () => {
302
- const customerId = 'stripe_flag_customer_3';
303
- createTestCustomer(customerId);
304
- const stripeDel = vi.fn();
305
- const serviceWithStripe = new GDPRComplianceService({
306
- db,
307
- stripeClient: makeMockStripe(stripeDel),
308
- });
309
- const result = await serviceWithStripe.deleteCustomerData(customerId, {
310
- deleteFromStripe: false,
311
- });
312
- expect(stripeDel).not.toHaveBeenCalled();
313
- expect(result.stripeDeleted).toBe(false);
314
- });
315
- });
316
- describe('Data Deletion (Article 17) — dryRun', () => {
317
- it('should return counts without deleting data', async () => {
318
- const customerId = 'dryrun_customer_1';
319
- createTestCustomer(customerId);
320
- const result = await gdprService.deleteCustomerData(customerId, {
321
- deleteFromStripe: false,
322
- dryRun: true,
323
- });
324
- expect(result.counts.subscriptions).toBe(1);
325
- expect(result.counts.invoices).toBe(1);
326
- expect(result.counts.licenseKeys).toBe(1);
327
- expect(result.counts.webhookEvents).toBe(1);
328
- // Data remains intact — hasCustomerData + row-count probe both confirm.
329
- expect(gdprService.hasCustomerData(customerId)).toBe(true);
330
- const invoices = db.prepare(`SELECT id FROM invoices WHERE customer_id = ?`).all(customerId);
331
- expect(invoices).toHaveLength(1);
332
- const subs = db
333
- .prepare(`SELECT id FROM user_subscriptions WHERE customer_id = ?`)
334
- .all(customerId);
335
- expect(subs).toHaveLength(1);
336
- });
337
- // The mock-chain suite asserted `db.exec` was never called with BEGIN/COMMIT in
338
- // dry run. With real SQLite we cannot observe that without wrapping `exec`, and
339
- // the stronger property — "dry run does not mutate the database" — is already
340
- // proven by the data-unchanged assertion above. Transaction boundaries are an
341
- // implementation detail.
342
- it.skip('should not start a transaction in dry run (covered by data-unchanged assertion)', () => { });
343
- it('should not call Stripe deletion in dry run', async () => {
344
- const customerId = 'dryrun_customer_3';
345
- createTestCustomer(customerId);
346
- const stripeDel = vi.fn();
347
- const serviceWithStripe = new GDPRComplianceService({
348
- db,
349
- stripeClient: makeMockStripe(stripeDel),
350
- });
351
- await serviceWithStripe.deleteCustomerData(customerId, { dryRun: true });
352
- expect(stripeDel).not.toHaveBeenCalled();
353
- });
354
- });
355
- describe('Utility Methods', () => {
356
- it('should check if customer has data', () => {
357
- const customerId = 'test_customer_123';
358
- expect(gdprService.hasCustomerData(customerId)).toBe(false);
359
- createTestCustomer(customerId);
360
- expect(gdprService.hasCustomerData(customerId)).toBe(true);
361
- });
362
- it('should return data summary', () => {
363
- const customerId = 'test_customer_123';
364
- createTestCustomer(customerId);
365
- const summary = gdprService.getDataSummary(customerId);
366
- expect(summary.hasSubscription).toBe(true);
367
- expect(summary.invoiceCount).toBe(1);
368
- expect(summary.licenseKeyCount).toBe(1);
369
- expect(summary.stripeCustomerId).toBe(`cus_${customerId}`);
370
- });
371
- it('should return empty summary for non-existent customer', () => {
372
- const summary = gdprService.getDataSummary('non_existent');
373
- expect(summary.hasSubscription).toBe(false);
374
- expect(summary.invoiceCount).toBe(0);
375
- expect(summary.licenseKeyCount).toBe(0);
376
- expect(summary.stripeCustomerId).toBeNull();
377
- });
378
- });
379
- });
380
- //# sourceMappingURL=GDPRCompliance.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GDPRCompliance.test.js","sourceRoot":"","sources":["../../../tests/billing/GDPRCompliance.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;A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CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACpC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACvC,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE,CAAA;QAC7C,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,18 +0,0 @@
1
- /**
2
- * SMI-3415: StripeClient Tests
3
- *
4
- * Tests for StripeClient wrapper including:
5
- * - Constructor initialization
6
- * - Customer management (create, get, update)
7
- * - Checkout session creation
8
- * - Subscription management (get, list, update, cancel, reactivate)
9
- * - Portal session creation
10
- * - Invoice management (list, get, upcoming)
11
- * - Webhook signature verification
12
- * - Price ID resolution
13
- * - Static mapSubscriptionStatus delegation
14
- *
15
- * All Stripe SDK calls are mocked — no real API calls.
16
- */
17
- export {};
18
- //# sourceMappingURL=StripeClient.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StripeClient.test.d.ts","sourceRoot":"","sources":["../../../tests/billing/StripeClient.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}