|
1 | 1 | import {createAdminSessionAsApp, formatOperationInfo, resolveApiVersion, validateSingleOperation} from './common.js' |
2 | 2 | import {OrganizationApp} from '../../models/organization.js' |
| 3 | +import {BULK_OPERATIONS_MIN_API_VERSION} from '../bulk-operations/constants.js' |
3 | 4 | import {ensureAuthenticatedAdminAsApp} from '@shopify/cli-kit/node/session' |
4 | 5 | import {fetchApiVersions} from '@shopify/cli-kit/node/api/admin' |
5 | 6 | import {describe, test, expect, vi, beforeEach} from 'vitest' |
@@ -126,7 +127,7 @@ describe('resolveApiVersion', () => { |
126 | 127 | const result = await resolveApiVersion({ |
127 | 128 | adminSession: mockAdminSession, |
128 | 129 | userSpecifiedVersion: '2024-04', |
129 | | - minimumDefaultVersion: '2026-01', |
| 130 | + minimumDefaultVersion: BULK_OPERATIONS_MIN_API_VERSION, |
130 | 131 | }) |
131 | 132 |
|
132 | 133 | expect(result).toBe('2024-04') |
@@ -181,21 +182,27 @@ describe('resolveApiVersion', () => { |
181 | 182 | {handle: '2025-10', supported: true}, |
182 | 183 | ]) |
183 | 184 |
|
184 | | - const result = await resolveApiVersion({adminSession: mockAdminSession, minimumDefaultVersion: '2026-01'}) |
| 185 | + const result = await resolveApiVersion({ |
| 186 | + adminSession: mockAdminSession, |
| 187 | + minimumDefaultVersion: BULK_OPERATIONS_MIN_API_VERSION, |
| 188 | + }) |
185 | 189 |
|
186 | | - expect(result).toBe('2026-01') |
| 190 | + expect(result).toBe(BULK_OPERATIONS_MIN_API_VERSION) |
187 | 191 | expect(fetchApiVersions).toHaveBeenCalledWith(mockAdminSession) |
188 | 192 | }) |
189 | 193 |
|
190 | 194 | test('returns most recent supported version when newer than minimum version', async () => { |
191 | 195 | vi.mocked(fetchApiVersions).mockResolvedValue([ |
192 | | - {handle: '2026-01', supported: true}, |
| 196 | + {handle: BULK_OPERATIONS_MIN_API_VERSION, supported: true}, |
193 | 197 | {handle: '2026-04', supported: true}, |
194 | 198 | {handle: '2026-07', supported: true}, |
195 | 199 | {handle: '2027-01', supported: false}, |
196 | 200 | ]) |
197 | 201 |
|
198 | | - const result = await resolveApiVersion({adminSession: mockAdminSession, minimumDefaultVersion: '2026-01'}) |
| 202 | + const result = await resolveApiVersion({ |
| 203 | + adminSession: mockAdminSession, |
| 204 | + minimumDefaultVersion: BULK_OPERATIONS_MIN_API_VERSION, |
| 205 | + }) |
199 | 206 |
|
200 | 207 | expect(result).toBe('2026-07') |
201 | 208 | expect(fetchApiVersions).toHaveBeenCalledWith(mockAdminSession) |
|
0 commit comments