Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Remove admin tests from @spree/sdk, admin functionality moved to admin-sdk

Damian Legawiecd9a60ce1b816
diff --git a/packages/sdk/tests/admin/adjustments.test.ts b/packages/sdk/tests/admin/adjustments.test.ts
deleted file mode 100644
index b5e3dd54e7..0000000000
--- a/packages/sdk/tests/admin/adjustments.test.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import { describe, it, expect, beforeAll } from 'vitest';
-import { createAdminTestClient } from '../helpers';
-import { adminFixtures } from '../mocks/admin-handlers';
-import type { SpreeClient } from '../../src';
-
-describe('admin / orders.adjustments', () => {
- let client: SpreeClient;
- beforeAll(() => { client = createAdminTestClient(); });
-
- const orderId = 'or_1';
-
- describe('list', () => {
- it('returns paginated adjustments', async () => {
- const result = await client.admin.orders.adjustments.list(orderId);
-
- expect(result.data).toHaveLength(1);
- expect(result.data[0].label).toBe('Admin discount');
- expect(result.meta.page).toBe(1);
- });
- });
-
- describe('create', () => {
- it('creates an adjustment', async () => {
- const result = await client.admin.orders.adjustments.create(orderId, {
- amount: -5.0,
- label: 'Admin discount',
- });
-
- expect(result.id).toBe(adminFixtures.adjustment.id);
- expect(result.amount).toBe('-5.0');
- expect(result.label).toBe('Admin discount');
- });
- });
-
- describe('get', () => {
- it('returns an adjustment by ID', async () => {
- const result = await client.admin.orders.adjustments.get(orderId, 'adj_1');
-
- expect(result.id).toBe(adminFixtures.adjustment.id);
- expect(result.eligible).toBe(true);
- });
- });
-
- describe('update', () => {
- it('updates an adjustment', async () => {
- const result = await client.admin.orders.adjustments.update(orderId, 'adj_1', {
- amount: 10.0,
- label: 'Updated discount',
- });
-
- expect(result.amount).toBe('10.0');
- expect(result.label).toBe('Updated discount');
- });
- });
-
- describe('delete', () => {
- it('deletes an adjustment', async () => {
- await expect(
- client.admin.orders.adjustments.delete(orderId, 'adj_1')
- ).resolves.toBeUndefined();
- });
- });
-});
diff --git a/packages/sdk/tests/admin/auth.test.ts b/packages/sdk/tests/admin/auth.test.ts
deleted file mode 100644
index 2b02f2865b..0000000000
--- a/packages/sdk/tests/admin/auth.test.ts
+++ /dev/null
@@ -1,64 +0,0 @@
-import { describe, it, expect } from 'vitest';
-import { server } from '../mocks/server';
-import { http, HttpResponse } from 'msw';
-import { createAdminTestClient, TEST_BASE_URL } from '../helpers';
-
-const API_PREFIX = `${TEST_BASE_URL}/api/v3/admin`;
-
-describe('admin auth', () => {
- describe('login', () => {
- it('returns auth tokens on successful login', async () => {
- const client = createAdminTestClient();
- const result = await client.admin.auth.login({
- email: '[email protected]',
- password: 'password123',
- });
-
- expect(result.token).toBe('admin-jwt-token');
- expect(result.user.email).toBe('[email protected]');
- expect(result.user.first_name).toBe('Admin');
- });
-
- it('throws SpreeError on invalid credentials', async () => {
- server.use(
- http.post(`${API_PREFIX}/auth/login`, () =>
- HttpResponse.json(
- { error: { code: 'authentication_failed', message: 'Invalid email or password' } },
- { status: 401 }
- )
- )
- );
-
- const client = createAdminTestClient();
- await expect(
- client.admin.auth.login({ email: '[email protected]', password: 'wrong' })
- ).rejects.toThrow('Invalid email or password');
- });
- });
-
- describe('refresh', () => {
- it('returns new tokens', async () => {
- const client = createAdminTestClient();
- const result = await client.admin.auth.refresh({ token: 'old-admin-token' });
-
- expect(result.token).toBe('refreshed-admin-jwt-token');
- expect(result.user.email).toBe('[email protected]');
- });
-
- it('throws SpreeError on invalid token', async () => {
- server.use(
- http.post(`${API_PREFIX}/auth/refresh`, () =>
- HttpResponse.json(
- { error: { code: 'authentication_required', message: 'Authentication required' } },
- { status: 401 }
- )
- )
- );
-
- const client = createAdminTestClient();
- await expect(
- client.admin.auth.refresh({ token: 'invalid-token' })
- ).rejects.toThrow('Authentication required');
- });
- });
-});
diff --git a/packages/sdk/tests/admin/option-types.test.ts b/packages/sdk/tests/admin/option-types.test.ts
deleted file mode 100644
index 6807a15e41..0000000000
--- a/packages/sdk/tests/admin/option-types.test.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-import { describe, it, expect, beforeAll } from 'vitest';
-import { createAdminTestClient } from '../helpers';
-import { adminFixtures } from '../mocks/admin-handlers';
-import type { SpreeClient } from '../../src';
-
-describe('admin / optionTypes', () => {
- let client: SpreeClient;
- beforeAll(() => { client = createAdminTestClient(); });
-
- describe('list', () => {
- it('returns paginated option types', async () => {
- const result = await client.admin.optionTypes.list();
-
- expect(result.data).toHaveLength(1);
- expect(result.data[0].name).toBe('color');
- expect(result.meta.page).toBe(1);
- expect(result.meta.count).toBe(1);
- });
- });
-
- describe('create', () => {
- it('creates an option type', async () => {
- const result = await client.admin.optionTypes.create({
- name: 'color',
- presentation: 'Color',
- });
-
- expect(result.name).toBe(adminFixtures.optionType.name);
- expect(result.presentation).toBe('Color');
- });
- });
-
- describe('get', () => {
- it('returns an option type by ID', async () => {
- const result = await client.admin.optionTypes.get('ot_1');
-
- expect(result.name).toBe(adminFixtures.optionType.name);
- });
- });
-
- describe('update', () => {
- it('updates an option type', async () => {
- const result = await client.admin.optionTypes.update('ot_1', {
- presentation: 'Updated Color',
- });
-
- expect(result.presentation).toBe('Updated Color');
- });
- });
-
- describe('delete', () => {
- it('deletes an option type', async () => {
- await expect(
- client.admin.optionTypes.delete('ot_1')
- ).resolves.toBeUndefined();
- });
- });
-});
diff --git a/packages/sdk/tests/admin/orders.test.ts b/packages/sdk/tests/admin/orders.test.ts
deleted file mode 100644
index 2abeb3ea1d..0000000000
--- a/packages/sdk/tests/admin/orders.test.ts
+++ /dev/null
@@ -1,127 +0,0 @@
-import { describe, it, expect, beforeAll } from 'vitest';
-import { createAdminTestClient } from '../helpers';
-import { adminFixtures } from '../mocks/admin-handlers';
-import type { SpreeClient } from '../../src';
-
-describe('admin / orders', () => {
- let client: SpreeClient;
- beforeAll(() => { client = createAdminTestClient(); });
-
- describe('list', () => {
- it('returns paginated orders', async () => {
- const result = await client.admin.orders.list();
-
- expect(result.data).toHaveLength(1);
- expect(result.data[0].number).toBe('R100001');
- expect(result.meta.page).toBe(1);
- });
- });
-
- describe('create', () => {
- it('creates a draft order', async () => {
- const result = await client.admin.orders.create({
- email: '[email protected]',
- });
-
- expect(result.email).toBe('[email protected]');
- });
- });
-
- describe('get', () => {
- it('returns an order by ID', async () => {
- const result = await client.admin.orders.get('or_1');
-
- expect(result.id).toBe(adminFixtures.order.id);
- expect(result.email).toBe('[email protected]');
- });
- });
-
- describe('update', () => {
- it('updates an order', async () => {
- const result = await client.admin.orders.update('or_1', {
- email: '[email protected]',
- });
-
- expect(result.email).toBe('[email protected]');
- });
- });
-
- describe('delete', () => {
- it('deletes a draft order', async () => {
- await expect(
- client.admin.orders.delete('or_1')
- ).resolves.toBeUndefined();
- });
- });
-
- describe('cancel', () => {
- it('cancels an order', async () => {
- const result = await client.admin.orders.cancel('or_1');
-
- expect(result.state).toBe('canceled');
- });
- });
-
- describe('approve', () => {
- it('approves an order', async () => {
- const result = await client.admin.orders.approve('or_1');
-
- expect(result.approved_at).toBe('2026-03-06T12:00:00.000Z');
- });
- });
-
- describe('resume', () => {
- it('resumes a canceled order', async () => {
- const result = await client.admin.orders.resume('or_1');
-
- expect(result.state).toBe('resumed');
- });
- });
-
- describe('resendConfirmation', () => {
- it('resends confirmation email', async () => {
- const result = await client.admin.orders.resendConfirmation('or_1');
-
- expect(result.id).toBe(adminFixtures.order.id);
- });
- });
-
- describe('lineItems', () => {
- it('lists line items', async () => {
- const result = await client.admin.orders.lineItems.list('or_1');
-
- expect(result.data).toHaveLength(1);
- expect(result.data[0].quantity).toBe(2);
- });
-
- it('creates a line item', async () => {
- const result = await client.admin.orders.lineItems.create('or_1', {
- variant_id: 'var_1',
- quantity: 2,
- });
-
- expect(result.variant_id).toBe('var_1');
- expect(result.quantity).toBe(2);
- });
-
- it('gets a line item', async () => {
- const result = await client.admin.orders.lineItems.get('or_1', 'li_1');
-
- expect(result.id).toBe(adminFixtures.lineItem.id);
- });
-
- it('updates a line item', async () => {
- const result = await client.admin.orders.lineItems.update('or_1', 'li_1', {
- quantity: 5,
- });
-
- expect(result.quantity).toBe(5);
- });
-
- it('deletes a line item', async () => {
- await expect(
- client.admin.orders.lineItems.delete('or_1', 'li_1')
- ).resolves.toBeUndefined();
- });
- });
-});
diff --git a/packages/sdk/tests/admin/payments.test.ts b/packages/sdk/tests/admin/payments.test.ts
deleted file mode 100644
index 50e57744eb..0000000000
--- a/packages/sdk/tests/admin/payments.test.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-import { describe, it, expect, beforeAll } from 'vitest';
-import { createAdminTestClient } from '../helpers';
-import { adminFixtures } from '../mocks/admin-handlers';
-import type { SpreeClient } from '../../src';
-
-describe('admin / orders.payments', () => {
- let client: SpreeClient;
- beforeAll(() => { client = createAdminTestClient(); });
-
- const orderId = 'or_1';
-
- describe('list', () => {
- it('returns paginated payments', async () => {
- const result = await client.admin.orders.payments.list(orderId);
-
- expect(result.data).toHaveLength(1);
- expect(result.data[0].number).toBe('P100001');
- expect(result.meta.page).toBe(1);
- });
- });
-
- describe('create', () => {
- it('creates a payment', async () => {
- const result = await client.admin.orders.payments.create(orderId, {
- payment_method_id: 'pm_1',
- amount: 29.99,
- });
-
- expect(result.id).toBe(adminFixtures.payment.id);
- expect(result.amount).toBe('29.99');
- });
- });
-
- describe('get', () => {
- it('returns a payment by ID', async () => {
- const result = await client.admin.orders.payments.get(orderId, 'py_1');
-
- expect(result.id).toBe(adminFixtures.payment.id);
- expect(result.state).toBe('completed');
- });
- });
-
- describe('capture', () => {
- it('captures a payment', async () => {
- const result = await client.admin.orders.payments.capture(orderId, 'py_1');
-
- expect(result.state).toBe('completed');
- });
- });
-
- describe('void', () => {
- it('voids a payment', async () => {
- const result = await client.admin.orders.payments.void(orderId, 'py_1');
-
- expect(result.state).toBe('void');
- });
- });
-});
diff --git a/packages/sdk/tests/admin/products.test.ts b/packages/sdk/tests/admin/products.test.ts
deleted file mode 100644
index aab74a74e8..0000000000
--- a/packages/sdk/tests/admin/products.test.ts
+++ /dev/null
@@ -1,175 +0,0 @@
-import { describe, it, expect, beforeAll } from 'vitest';
-import { createAdminTestClient } from '../helpers';
-import { adminFixtures } from '../mocks/admin-handlers';
-import type { SpreeClient } from '../../src';
-
-describe('admin / products', () => {
- let client: SpreeClient;
- beforeAll(() => { client = createAdminTestClient(); });
-
- describe('list', () => {
- it('returns paginated products', async () => {
- const result = await client.admin.products.list();
-
- expect(result.data).toHaveLength(1);
- expect(result.data[0].name).toBe('Admin Product');
- expect(result.meta.page).toBe(1);
- });
- });
-
- describe('create', () => {
- it('creates a product', async () => {
- const result = await client.admin.products.create({
- name: 'New Product',
- price: 29.99,
- shipping_category_id: 'sc_1',
- });
-
- expect(result.name).toBe(adminFixtures.product.name);
- });
- });
-
- describe('get', () => {
- it('returns a product by ID', async () => {
- const result = await client.admin.products.get('prod_1');
-
- expect(result.name).toBe(adminFixtures.product.name);
- expect(result.slug).toBe('admin-product');
- });
- });
-
- describe('update', () => {
- it('updates a product', async () => {
- const result = await client.admin.products.update('prod_1', {
- name: 'Updated Product',
- });
-
- expect(result.name).toBe('Updated Product');
- });
- });
-
- describe('delete', () => {
- it('deletes a product', async () => {
- await expect(
- client.admin.products.delete('prod_1')
- ).resolves.toBeUndefined();
- });
- });
-
- describe('assets', () => {
- it('lists product assets', async () => {
- const result = await client.admin.products.assets.list('prod_1');
-
- expect(result.data).toHaveLength(1);
- expect(result.data[0].alt).toBe('Product image');
- });
-
- it('creates an asset', async () => {
- const result = await client.admin.products.assets.create('prod_1', {
- alt: 'New image',
- });
-
- expect(result.alt).toBe(adminFixtures.asset.alt);
- });
-
- it('creates an asset from URL (returns 202)', async () => {
- await expect(
- client.admin.products.assets.create('prod_1', {
- url: 'https://example.com/image.jpg',
- position: 1,
- })
- ).resolves.toBeFalsy();
- });
-
- it('updates an asset', async () => {
- const result = await client.admin.products.assets.update('prod_1', 'asset_1', {
- alt: 'Updated alt',
- });
-
- expect(result.alt).toBe('Updated alt');
- });
-
- it('deletes an asset', async () => {
- await expect(
- client.admin.products.assets.delete('prod_1', 'asset_1')
- ).resolves.toBeUndefined();
- });
- });
-
- describe('variants', () => {
- it('lists product variants', async () => {
- const result = await client.admin.products.variants.list('prod_1');
-
- expect(result.data).toHaveLength(1);
- expect(result.data[0].sku).toBe('VAR-001');
- });
-
- it('creates a variant', async () => {
- const result = await client.admin.products.variants.create('prod_1', {
- sku: 'VAR-NEW',
- price: 19.99,
- });
-
- expect(result.sku).toBe(adminFixtures.variant.sku);
- });
-
- it('gets a variant', async () => {
- const result = await client.admin.products.variants.get('prod_1', 'var_1');
-
- expect(result.id).toBe(adminFixtures.variant.id);
- });
-
- it('updates a variant', async () => {
- const result = await client.admin.products.variants.update('prod_1', 'var_1', {
- sku: 'VAR-UPDATED',
- });
-
- expect(result.sku).toBe('VAR-UPDATED');
- });
-
- it('deletes a variant', async () => {
- await expect(
- client.admin.products.variants.delete('prod_1', 'var_1')
- ).resolves.toBeUndefined();
- });
-
- describe('assets', () => {
- it('lists variant assets', async () => {
- const result = await client.admin.products.variants.assets.list('prod_1', 'var_1');
-
- expect(result.data).toHaveLength(1);
- expect(result.data[0].alt).toBe('Product image');
- });
-
- it('creates a variant asset', async () => {
- const result = await client.admin.products.variants.assets.create('prod_1', 'var_1', {
- alt: 'Variant image',
- });
-
- expect(result.alt).toBe(adminFixtures.asset.alt);
- });
-
- it('creates a variant asset from URL (returns 202)', async () => {
- await expect(
- client.admin.products.variants.assets.create('prod_1', 'var_1', {
- url: 'https://example.com/variant.jpg',
- })
- ).resolves.toBeFalsy();
- });
-
- it('updates a variant asset', async () => {
- const result = await client.admin.products.variants.assets.update('prod_1', 'var_1', 'asset_1', {
- alt: 'Updated variant alt',
- });
-
- expect(result.alt).toBe('Updated variant alt');
- });
-
- it('deletes a variant asset', async () => {
- await expect(
- client.admin.products.variants.assets.delete('prod_1', 'var_1', 'asset_1')
- ).resolves.toBeUndefined();
- });
- });
- });
-});
diff --git a/packages/sdk/tests/admin/refunds.test.ts b/packages/sdk/tests/admin/refunds.test.ts
deleted file mode 100644
index ca8b93ead2..0000000000
--- a/packages/sdk/tests/admin/refunds.test.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { describe, it, expect, beforeAll } from 'vitest';
-import { createAdminTestClient } from '../helpers';
-import { adminFixtures } from '../mocks/admin-handlers';
-import type { SpreeClient } from '../../src';
-
-describe('admin / orders.refunds', () => {
- let client: SpreeClient;
- beforeAll(() => { client = createAdminTestClient(); });
-
- const orderId = 'or_1';
-
- describe('list', () => {
- it('returns paginated refunds', async () => {
- const result = await client.admin.orders.refunds.list(orderId);
-
- expect(result.data).toHaveLength(1);
- expect(result.data[0].amount).toBe('5.0');
- expect(result.meta.page).toBe(1);
- });
- });
-
- describe('create', () => {
- it('creates a refund', async () => {
- const result = await client.admin.orders.refunds.create(orderId, {
- payment_id: 'py_1',
- amount: 5.0,
- refund_reason_id: 'rr_1',
- });
-
- expect(result.id).toBe(adminFixtures.refund.id);
- expect(result.amount).toBe('5.0');
- expect(result.payment_id).toBe('py_1');
- });
- });
-});
diff --git a/packages/sdk/tests/admin/shipments.test.ts b/packages/sdk/tests/admin/shipments.test.ts
deleted file mode 100644
index 21ed544227..0000000000
--- a/packages/sdk/tests/admin/shipments.test.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-import { describe, it, expect, beforeAll } from 'vitest';
-import { createAdminTestClient } from '../helpers';
-import { adminFixtures } from '../mocks/admin-handlers';
-import type { SpreeClient } from '../../src';
-
-describe('admin / orders.shipments', () => {
- let client: SpreeClient;
- beforeAll(() => { client = createAdminTestClient(); });
-
- const orderId = 'or_1';
-
- describe('list', () => {
- it('returns paginated shipments', async () => {
- const result = await client.admin.orders.shipments.list(orderId);
-
- expect(result.data).toHaveLength(1);
- expect(result.data[0].number).toBe('H12345');
- expect(result.meta.page).toBe(1);
- });
- });
-
- describe('get', () => {
- it('returns a shipment by ID', async () => {
- const result = await client.admin.orders.shipments.get(orderId, 'ship_1');
-
- expect(result.id).toBe(adminFixtures.shipment.id);
- expect(result.state).toBe('ready');
- });
- });
-
- describe('update', () => {
- it('updates tracking on a shipment', async () => {
- const result = await client.admin.orders.shipments.update(orderId, 'ship_1', {
- tracking: '1Z999AA10123456784',
- });
-
- expect(result.tracking).toBe('1Z999AA10123456784');
- });
- });
-
- describe('ship', () => {
- it('ships a shipment', async () => {
- const result = await client.admin.orders.shipments.ship(orderId, 'ship_1');
-
- expect(result.state).toBe('shipped');
- expect(result.shipped_at).toBeTruthy();
- });
- });
-
- describe('cancel', () => {
- it('cancels a shipment', async () => {
- const result = await client.admin.orders.shipments.cancel(orderId, 'ship_1');
-
- expect(result.state).toBe('canceled');
- });
- });
-
- describe('resume', () => {
- it('resumes a canceled shipment', async () => {
- const result = await client.admin.orders.shipments.resume(orderId, 'ship_1');
-
- expect(result.state).toBe('ready');
- });
- });
-
- describe('split', () => {
- it('splits a shipment to a new stock location', async () => {
- const result = await client.admin.orders.shipments.split(orderId, 'ship_1', {
- variant_id: 'var_1',
- quantity: 1,
- stock_location_id: 'sl_2',
- });
-
- expect(result.data).toHaveLength(2);
- expect(result.data[0].id).toBe('ship_1');
- expect(result.data[1].id).toBe('ship_2');
- });
- });
-});
diff --git a/packages/sdk/tests/admin/taxonomies.test.ts b/packages/sdk/tests/admin/taxonomies.test.ts
deleted file mode 100644
index 419eb4f4ec..0000000000
--- a/packages/sdk/tests/admin/taxonomies.test.ts
+++ /dev/null
@@ -1,92 +0,0 @@
-import { describe, it, expect, beforeAll } from 'vitest';
-import { createAdminTestClient } from '../helpers';
-import { adminFixtures } from '../mocks/admin-handlers';
-import type { SpreeClient } from '../../src';
-
-describe('admin / taxonomies', () => {
- let client: SpreeClient;
- beforeAll(() => { client = createAdminTestClient(); });
-
- describe('list', () => {
- it('returns paginated taxonomies', async () => {
- const result = await client.admin.taxonomies.list();
-
- expect(result.data).toHaveLength(1);
- expect(result.data[0].name).toBe('Categories');
- expect(result.meta.page).toBe(1);
- });
- });
-
- describe('create', () => {
- it('creates a taxonomy', async () => {
- const result = await client.admin.taxonomies.create({
- name: 'Categories',
- });
-
- expect(result.name).toBe(adminFixtures.taxonomy.name);
- });
- });
-
- describe('get', () => {
- it('returns a taxonomy by ID', async () => {
- const result = await client.admin.taxonomies.get('txmy_1');
-
- expect(result.name).toBe(adminFixtures.taxonomy.name);
- });
- });
-
- describe('update', () => {
- it('updates a taxonomy', async () => {
- const result = await client.admin.taxonomies.update('txmy_1', {
- name: 'Updated Categories',
- });
-
- expect(result.name).toBe('Updated Categories');
- });
- });
-
- describe('delete', () => {
- it('deletes a taxonomy', async () => {
- await expect(
- client.admin.taxonomies.delete('txmy_1')
- ).resolves.toBeUndefined();
- });
- });
-
- describe('taxons', () => {
- it('lists taxonomy taxons', async () => {
- const result = await client.admin.taxonomies.taxons.list('txmy_1');
-
- expect(result.data).toHaveLength(1);
- expect(result.data[0].name).toBe('Clothing');
- });
-
- it('creates a taxon', async () => {
- const result = await client.admin.taxonomies.taxons.create('txmy_1', {
- name: 'Clothing',
- });
-
- expect(result.name).toBe(adminFixtures.taxon.name);
- });
-
- it('gets a taxon', async () => {
- const result = await client.admin.taxonomies.taxons.get('txmy_1', 'txon_1');
-
- expect(result.id).toBe(adminFixtures.taxon.id);
- });
-
- it('updates a taxon', async () => {
- const result = await client.admin.taxonomies.taxons.update('txmy_1', 'txon_1', {
- name: 'Updated Clothing',
- });
-
- expect(result.name).toBe('Updated Clothing');
- });
-
- it('deletes a taxon', async () => {
- await expect(
- client.admin.taxonomies.taxons.delete('txmy_1', 'txon_1')
- ).resolves.toBeUndefined();
- });
- });
-});
diff --git a/packages/sdk/tests/admin/taxons.test.ts b/packages/sdk/tests/admin/taxons.test.ts
deleted file mode 100644
index d2c0899f0a..0000000000
--- a/packages/sdk/tests/admin/taxons.test.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { describe, it, expect, beforeAll } from 'vitest';
-import { createAdminTestClient } from '../helpers';
-import { adminFixtures } from '../mocks/admin-handlers';
-import type { SpreeClient } from '../../src';
-
-describe('admin / taxons', () => {
- let client: SpreeClient;
- beforeAll(() => { client = createAdminTestClient(); });
-
- describe('list', () => {
- it('returns paginated taxons', async () => {
- const result = await client.admin.taxons.list();
-
- expect(result.data).toHaveLength(1);
- expect(result.data[0].name).toBe('Clothing');
- expect(result.meta.page).toBe(1);
- });
- });
-
- describe('get', () => {
- it('returns a taxon by ID', async () => {
- const result = await client.admin.taxons.get('txon_1');
-
- expect(result.name).toBe(adminFixtures.taxon.name);
- expect(result.permalink).toBe('categories/clothing');
- });
- });
-});
diff --git a/packages/sdk/tests/helpers.ts b/packages/sdk/tests/helpers.ts
index 0b827bae26..af50a99b6e 100644
--- a/packages/sdk/tests/helpers.ts
+++ b/packages/sdk/tests/helpers.ts
@@ -2,18 +2,10 @@ import { createClient } from '../src';
export const TEST_BASE_URL = 'https://demo.spreecommerce.org';
export const TEST_API_KEY = 'test-publishable-key';
-export const TEST_SECRET_KEY = 'spree_sk_test_admin';
export function createTestClient() {
return createClient({
baseUrl: TEST_BASE_URL,
publishableKey: TEST_API_KEY,
});
-}
-
-export function createAdminTestClient() {
- return createSpreeClient({
- baseUrl: TEST_BASE_URL,
- secretKey: TEST_SECRET_KEY,
- });
-}
+}
\ No newline at end of file