|
1 | | -import {getBulkOperationStatus, listBulkOperations, normalizeBulkOperationId} from './bulk-operation-status.js' |
| 1 | +import { |
| 2 | + getBulkOperationStatus, |
| 3 | + listBulkOperations, |
| 4 | + normalizeBulkOperationId, |
| 5 | + extractBulkOperationId, |
| 6 | +} from './bulk-operation-status.js' |
2 | 7 | import {GetBulkOperationByIdQuery} from '../../api/graphql/bulk-operations/generated/get-bulk-operation-by-id.js' |
3 | 8 | import {OrganizationApp, Organization, OrganizationSource} from '../../models/organization.js' |
4 | 9 | import {ListBulkOperationsQuery} from '../../api/graphql/bulk-operations/generated/list-bulk-operations.js' |
@@ -53,6 +58,18 @@ describe('normalizeBulkOperationId', () => { |
53 | 58 | }) |
54 | 59 | }) |
55 | 60 |
|
| 61 | +describe('extractBulkOperationId', () => { |
| 62 | + test('extracts numeric ID from GID', () => { |
| 63 | + expect(extractBulkOperationId('gid://shopify/BulkOperation/123')).toBe('123') |
| 64 | + expect(extractBulkOperationId('gid://shopify/BulkOperation/456789')).toBe('456789') |
| 65 | + }) |
| 66 | + |
| 67 | + test('returns input as-is if not a valid GID format', () => { |
| 68 | + expect(extractBulkOperationId('invalid-id')).toBe('invalid-id') |
| 69 | + expect(extractBulkOperationId('123')).toBe('123') |
| 70 | + }) |
| 71 | +}) |
| 72 | + |
56 | 73 | describe('getBulkOperationStatus', () => { |
57 | 74 | function mockBulkOperation( |
58 | 75 | overrides?: Partial<NonNullable<GetBulkOperationByIdQuery['bulkOperation']>>, |
@@ -239,15 +256,15 @@ describe('listBulkOperations', () => { |
239 | 256 | │ │ |
240 | 257 | ╰──────────────────────────────────────────────────────────────────────────────╯ |
241 | 258 |
|
242 | | - ID STATUS COU DATE CREATED DATE RESULTS |
243 | | - T FINISHED |
| 259 | + I STATUS COUNT DATE CREATED DATE FINISHED RESULTS |
244 | 260 |
|
245 | | - ──────────────── ────── ─── ──────────── ─────────── ─────────────────────────── |
246 | | - ──────────── ── ── ─────── ─────── ─────────────────── |
247 | | - gid://shopify/Bu COMPLE 123 2025-11-10 2025-11-10 download ( https://example. |
248 | | - kOperation/1 ED 5K 12:37:52 16:37:12 com/results.jsonl ) |
249 | | - gid://shopify/Bu RUNNIN 100 2025-11-11 |
250 | | - kOperation/2 15:37:52" |
| 261 | + ─ ─────── ───── ────────────── ────────────── ────────────────────────────────── |
| 262 | + ─ ──── ──── ──────────── |
| 263 | + 1 COMPLET 123.5 2025-11-10 2025-11-10 download ( |
| 264 | + D 12:37:52 16:37:12 https://example.com/results.jsonl |
| 265 | + ) |
| 266 | + 2 RUNNING 100 2025-11-11 |
| 267 | + 15:37:52" |
251 | 268 | `) |
252 | 269 | }) |
253 | 270 |
|
|
0 commit comments