|
@@ -2,52 +2,43 @@ import { describe, it, expect, beforeEach } from 'vitest';
|
|
|
import { testClient } from 'hono/testing';
|
|
import { testClient } from 'hono/testing';
|
|
|
import { IntegrationTestDatabase, setupIntegrationDatabaseHooksWithEntities } from '@d8d/shared-test-util';
|
|
import { IntegrationTestDatabase, setupIntegrationDatabaseHooksWithEntities } from '@d8d/shared-test-util';
|
|
|
import { JWTUtil } from '@d8d/shared-utils';
|
|
import { JWTUtil } from '@d8d/shared-utils';
|
|
|
-import { UserEntityMt, Role } from '@d8d/user-module-mt';
|
|
|
|
|
|
|
+import { UserEntityMt, RoleMt } from '@d8d/user-module-mt';
|
|
|
import { FileMt } from '@d8d/file-module-mt';
|
|
import { FileMt } from '@d8d/file-module-mt';
|
|
|
import { SupplierMt } from '@d8d/supplier-module-mt';
|
|
import { SupplierMt } from '@d8d/supplier-module-mt';
|
|
|
import { MerchantMt } from '@d8d/merchant-module-mt';
|
|
import { MerchantMt } from '@d8d/merchant-module-mt';
|
|
|
-import { adminGoodsRoutes } from '../../src/routes';
|
|
|
|
|
-import { Goods, GoodsCategory } from '../../src/entities';
|
|
|
|
|
|
|
+import { adminGoodsRoutesMt } from '../../src/routes/index.mt';
|
|
|
|
|
+import { GoodsMt, GoodsCategoryMt } from '../../src/entities/index.mt';
|
|
|
|
|
+import { GoodsTestFactory } from '../factories/goods-test-factory';
|
|
|
|
|
|
|
|
// 设置集成测试钩子
|
|
// 设置集成测试钩子
|
|
|
setupIntegrationDatabaseHooksWithEntities([
|
|
setupIntegrationDatabaseHooksWithEntities([
|
|
|
- UserEntityMt, Role, Goods, GoodsCategory, File, SupplierMt, MerchantMt
|
|
|
|
|
|
|
+ UserEntityMt, RoleMt, GoodsMt, GoodsCategoryMt, FileMt, SupplierMt, MerchantMt
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
describe('管理员商品管理API集成测试', () => {
|
|
describe('管理员商品管理API集成测试', () => {
|
|
|
- let client: ReturnType<typeof testClient<typeof adminGoodsRoutes>>;
|
|
|
|
|
|
|
+ let client: ReturnType<typeof testClient<typeof adminGoodsRoutesMt>>;
|
|
|
let adminToken: string;
|
|
let adminToken: string;
|
|
|
let testUser: UserEntityMt;
|
|
let testUser: UserEntityMt;
|
|
|
let testAdmin: UserEntityMt;
|
|
let testAdmin: UserEntityMt;
|
|
|
- let testCategory: GoodsCategory;
|
|
|
|
|
|
|
+ let testCategory: GoodsCategoryMt;
|
|
|
let testSupplier: SupplierMt;
|
|
let testSupplier: SupplierMt;
|
|
|
let testMerchant: MerchantMt;
|
|
let testMerchant: MerchantMt;
|
|
|
|
|
+ let testFactory: GoodsTestFactory;
|
|
|
|
|
|
|
|
beforeEach(async () => {
|
|
beforeEach(async () => {
|
|
|
// 创建测试客户端
|
|
// 创建测试客户端
|
|
|
- client = testClient(adminGoodsRoutes);
|
|
|
|
|
|
|
+ client = testClient(adminGoodsRoutesMt);
|
|
|
|
|
|
|
|
- // 获取数据源
|
|
|
|
|
|
|
+ // 获取数据源并创建测试工厂
|
|
|
const dataSource = await IntegrationTestDatabase.getDataSource();
|
|
const dataSource = await IntegrationTestDatabase.getDataSource();
|
|
|
|
|
+ testFactory = new GoodsTestFactory(dataSource);
|
|
|
|
|
|
|
|
- // 创建测试用户
|
|
|
|
|
- const userRepository = dataSource.getRepository(UserEntityMt);
|
|
|
|
|
- testUser = userRepository.create({
|
|
|
|
|
- username: `test_user_${Math.floor(Math.random() * 100000)}`,
|
|
|
|
|
- password: 'test_password',
|
|
|
|
|
- nickname: '测试用户',
|
|
|
|
|
- registrationSource: 'web'
|
|
|
|
|
- });
|
|
|
|
|
- await userRepository.save(testUser);
|
|
|
|
|
-
|
|
|
|
|
- // 创建测试管理员用户
|
|
|
|
|
- testAdmin = userRepository.create({
|
|
|
|
|
- username: `test_admin_${Math.floor(Math.random() * 100000)}`,
|
|
|
|
|
- password: 'admin_password',
|
|
|
|
|
- nickname: '测试管理员',
|
|
|
|
|
- registrationSource: 'web'
|
|
|
|
|
- });
|
|
|
|
|
- await userRepository.save(testAdmin);
|
|
|
|
|
|
|
+ // 使用测试工厂创建测试数据
|
|
|
|
|
+ testUser = await testFactory.createTestUser();
|
|
|
|
|
+ testAdmin = await testFactory.createTestAdmin();
|
|
|
|
|
+ testCategory = await testFactory.createTestCategory(testUser.id);
|
|
|
|
|
+ testSupplier = await testFactory.createTestSupplier(testUser.id);
|
|
|
|
|
+ testMerchant = await testFactory.createTestMerchant(testUser.id);
|
|
|
|
|
|
|
|
// 生成测试管理员的token
|
|
// 生成测试管理员的token
|
|
|
adminToken = JWTUtil.generateToken({
|
|
adminToken = JWTUtil.generateToken({
|
|
@@ -55,84 +46,34 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
username: testAdmin.username,
|
|
username: testAdmin.username,
|
|
|
roles: [{name:'admin'}]
|
|
roles: [{name:'admin'}]
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
- // 创建测试商品分类
|
|
|
|
|
- const categoryRepository = dataSource.getRepository(GoodsCategory);
|
|
|
|
|
- testCategory = categoryRepository.create({
|
|
|
|
|
- name: '测试分类',
|
|
|
|
|
- parentId: 0,
|
|
|
|
|
- level: 1,
|
|
|
|
|
- state: 1,
|
|
|
|
|
- createdBy: testUser.id
|
|
|
|
|
- });
|
|
|
|
|
- await categoryRepository.save(testCategory);
|
|
|
|
|
-
|
|
|
|
|
- // 创建测试供应商
|
|
|
|
|
- const supplierRepository = dataSource.getRepository(SupplierMt);
|
|
|
|
|
- testSupplier = supplierRepository.create({
|
|
|
|
|
- name: '测试供应商',
|
|
|
|
|
- username: `test_supplier_${Math.floor(Math.random() * 100000)}`,
|
|
|
|
|
- password: 'password123',
|
|
|
|
|
- phone: '13800138000',
|
|
|
|
|
- realname: '测试供应商',
|
|
|
|
|
- state: 1,
|
|
|
|
|
- createdBy: testUser.id
|
|
|
|
|
- });
|
|
|
|
|
- await supplierRepository.save(testSupplier);
|
|
|
|
|
-
|
|
|
|
|
- // 创建测试商户
|
|
|
|
|
- const merchantRepository = dataSource.getRepository(MerchantMt);
|
|
|
|
|
- testMerchant = merchantRepository.create({
|
|
|
|
|
- name: '测试商户',
|
|
|
|
|
- username: `test_merchant_${Math.floor(Math.random() * 100000)}`,
|
|
|
|
|
- password: 'password123',
|
|
|
|
|
- phone: '13800138001',
|
|
|
|
|
- realname: '测试商户',
|
|
|
|
|
- state: 1,
|
|
|
|
|
- createdBy: testUser.id
|
|
|
|
|
- });
|
|
|
|
|
- await merchantRepository.save(testMerchant);
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
describe('GET /goods', () => {
|
|
describe('GET /goods', () => {
|
|
|
it('应该返回所有商品列表', async () => {
|
|
it('应该返回所有商品列表', async () => {
|
|
|
// 创建多个用户的商品
|
|
// 创建多个用户的商品
|
|
|
- const dataSource = await IntegrationTestDatabase.getDataSource();
|
|
|
|
|
- const goodsRepository = dataSource.getRepository(Goods);
|
|
|
|
|
-
|
|
|
|
|
- const userGoods1 = goodsRepository.create({
|
|
|
|
|
|
|
+ const userGoods1 = await testFactory.createTestGoods(testUser.id, {
|
|
|
name: '用户商品1',
|
|
name: '用户商品1',
|
|
|
price: 100.00,
|
|
price: 100.00,
|
|
|
costPrice: 80.00,
|
|
costPrice: 80.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
categoryId2: testCategory.id,
|
|
categoryId2: testCategory.id,
|
|
|
categoryId3: testCategory.id,
|
|
categoryId3: testCategory.id,
|
|
|
- goodsType: 1,
|
|
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
|
- state: 1,
|
|
|
|
|
- stock: 100,
|
|
|
|
|
- lowestBuy: 1,
|
|
|
|
|
- createdBy: testUser.id
|
|
|
|
|
|
|
+ stock: 100
|
|
|
});
|
|
});
|
|
|
- await goodsRepository.save(userGoods1);
|
|
|
|
|
|
|
|
|
|
- const userGoods2 = goodsRepository.create({
|
|
|
|
|
|
|
+ const userGoods2 = await testFactory.createTestGoods(testAdmin.id, {
|
|
|
name: '用户商品2',
|
|
name: '用户商品2',
|
|
|
price: 200.00,
|
|
price: 200.00,
|
|
|
costPrice: 160.00,
|
|
costPrice: 160.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
categoryId2: testCategory.id,
|
|
categoryId2: testCategory.id,
|
|
|
categoryId3: testCategory.id,
|
|
categoryId3: testCategory.id,
|
|
|
- goodsType: 1,
|
|
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
|
- state: 1,
|
|
|
|
|
- stock: 50,
|
|
|
|
|
- lowestBuy: 1,
|
|
|
|
|
- createdBy: testAdmin.id
|
|
|
|
|
|
|
+ stock: 50
|
|
|
});
|
|
});
|
|
|
- await goodsRepository.save(userGoods2);
|
|
|
|
|
|
|
|
|
|
const response = await client.index.$get({
|
|
const response = await client.index.$get({
|
|
|
query: {}
|
|
query: {}
|
|
@@ -232,24 +173,17 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
describe('GET /goods/:id', () => {
|
|
describe('GET /goods/:id', () => {
|
|
|
it('应该返回指定商品的详情', async () => {
|
|
it('应该返回指定商品的详情', async () => {
|
|
|
// 先创建一个商品
|
|
// 先创建一个商品
|
|
|
- const dataSource = await IntegrationTestDatabase.getDataSource();
|
|
|
|
|
- const goodsRepository = dataSource.getRepository(Goods);
|
|
|
|
|
- const testGoods = goodsRepository.create({
|
|
|
|
|
|
|
+ const testGoods = await testFactory.createTestGoods(testUser.id, {
|
|
|
name: '测试商品详情',
|
|
name: '测试商品详情',
|
|
|
price: 100.00,
|
|
price: 100.00,
|
|
|
costPrice: 80.00,
|
|
costPrice: 80.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
categoryId2: testCategory.id,
|
|
categoryId2: testCategory.id,
|
|
|
categoryId3: testCategory.id,
|
|
categoryId3: testCategory.id,
|
|
|
- goodsType: 1,
|
|
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
|
- state: 1,
|
|
|
|
|
- stock: 100,
|
|
|
|
|
- lowestBuy: 1,
|
|
|
|
|
- createdBy: testUser.id
|
|
|
|
|
|
|
+ stock: 100
|
|
|
});
|
|
});
|
|
|
- await goodsRepository.save(testGoods);
|
|
|
|
|
|
|
|
|
|
const response = await client[':id'].$get({
|
|
const response = await client[':id'].$get({
|
|
|
param: { id: testGoods.id }
|
|
param: { id: testGoods.id }
|
|
@@ -286,24 +220,17 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
describe('PUT /goods/:id', () => {
|
|
describe('PUT /goods/:id', () => {
|
|
|
it('应该成功更新任何商品', async () => {
|
|
it('应该成功更新任何商品', async () => {
|
|
|
// 先创建一个商品
|
|
// 先创建一个商品
|
|
|
- const dataSource = await IntegrationTestDatabase.getDataSource();
|
|
|
|
|
- const goodsRepository = dataSource.getRepository(Goods);
|
|
|
|
|
- const testGoods = goodsRepository.create({
|
|
|
|
|
|
|
+ const testGoods = await testFactory.createTestGoods(testUser.id, {
|
|
|
name: '测试更新商品',
|
|
name: '测试更新商品',
|
|
|
price: 100.00,
|
|
price: 100.00,
|
|
|
costPrice: 80.00,
|
|
costPrice: 80.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
categoryId2: testCategory.id,
|
|
categoryId2: testCategory.id,
|
|
|
categoryId3: testCategory.id,
|
|
categoryId3: testCategory.id,
|
|
|
- goodsType: 1,
|
|
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
|
- state: 1,
|
|
|
|
|
- stock: 100,
|
|
|
|
|
- lowestBuy: 1,
|
|
|
|
|
- createdBy: testUser.id
|
|
|
|
|
|
|
+ stock: 100
|
|
|
});
|
|
});
|
|
|
- await goodsRepository.save(testGoods);
|
|
|
|
|
|
|
|
|
|
const updateData = {
|
|
const updateData = {
|
|
|
name: '管理员更新后的商品名称',
|
|
name: '管理员更新后的商品名称',
|
|
@@ -337,24 +264,17 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
describe('DELETE /goods/:id', () => {
|
|
describe('DELETE /goods/:id', () => {
|
|
|
it('应该成功删除任何商品', async () => {
|
|
it('应该成功删除任何商品', async () => {
|
|
|
// 先创建一个商品
|
|
// 先创建一个商品
|
|
|
- const dataSource = await IntegrationTestDatabase.getDataSource();
|
|
|
|
|
- const goodsRepository = dataSource.getRepository(Goods);
|
|
|
|
|
- const testGoods = goodsRepository.create({
|
|
|
|
|
|
|
+ const testGoods = await testFactory.createTestGoods(testUser.id, {
|
|
|
name: '测试删除商品',
|
|
name: '测试删除商品',
|
|
|
price: 100.00,
|
|
price: 100.00,
|
|
|
costPrice: 80.00,
|
|
costPrice: 80.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
categoryId2: testCategory.id,
|
|
categoryId2: testCategory.id,
|
|
|
categoryId3: testCategory.id,
|
|
categoryId3: testCategory.id,
|
|
|
- goodsType: 1,
|
|
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
|
- state: 1,
|
|
|
|
|
- stock: 100,
|
|
|
|
|
- lowestBuy: 1,
|
|
|
|
|
- createdBy: testUser.id
|
|
|
|
|
|
|
+ stock: 100
|
|
|
});
|
|
});
|
|
|
- await goodsRepository.save(testGoods);
|
|
|
|
|
|
|
|
|
|
const response = await client[':id'].$delete({
|
|
const response = await client[':id'].$delete({
|
|
|
param: { id: testGoods.id }
|
|
param: { id: testGoods.id }
|
|
@@ -371,44 +291,33 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
|
|
|
|
|
describe('商品状态管理测试', () => {
|
|
describe('商品状态管理测试', () => {
|
|
|
it('应该正确处理商品状态变更', async () => {
|
|
it('应该正确处理商品状态变更', async () => {
|
|
|
- const dataSource = await IntegrationTestDatabase.getDataSource();
|
|
|
|
|
- const goodsRepository = dataSource.getRepository(Goods);
|
|
|
|
|
-
|
|
|
|
|
// 创建可用状态的商品
|
|
// 创建可用状态的商品
|
|
|
- const activeGoods = goodsRepository.create({
|
|
|
|
|
|
|
+ const activeGoods = await testFactory.createTestGoods(testUser.id, {
|
|
|
name: '可用商品',
|
|
name: '可用商品',
|
|
|
price: 100.00,
|
|
price: 100.00,
|
|
|
costPrice: 80.00,
|
|
costPrice: 80.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
categoryId2: testCategory.id,
|
|
categoryId2: testCategory.id,
|
|
|
categoryId3: testCategory.id,
|
|
categoryId3: testCategory.id,
|
|
|
- goodsType: 1,
|
|
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
|
state: 1,
|
|
state: 1,
|
|
|
- stock: 100,
|
|
|
|
|
- lowestBuy: 1,
|
|
|
|
|
- createdBy: testUser.id
|
|
|
|
|
|
|
+ stock: 100
|
|
|
});
|
|
});
|
|
|
- await goodsRepository.save(activeGoods);
|
|
|
|
|
|
|
|
|
|
// 创建不可用状态的商品
|
|
// 创建不可用状态的商品
|
|
|
- const inactiveGoods = goodsRepository.create({
|
|
|
|
|
|
|
+ const inactiveGoods = await testFactory.createTestGoods(testUser.id, {
|
|
|
name: '不可用商品',
|
|
name: '不可用商品',
|
|
|
price: 200.00,
|
|
price: 200.00,
|
|
|
costPrice: 160.00,
|
|
costPrice: 160.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
categoryId2: testCategory.id,
|
|
categoryId2: testCategory.id,
|
|
|
categoryId3: testCategory.id,
|
|
categoryId3: testCategory.id,
|
|
|
- goodsType: 1,
|
|
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
|
state: 2,
|
|
state: 2,
|
|
|
- stock: 50,
|
|
|
|
|
- lowestBuy: 1,
|
|
|
|
|
- createdBy: testUser.id
|
|
|
|
|
|
|
+ stock: 50
|
|
|
});
|
|
});
|
|
|
- await goodsRepository.save(inactiveGoods);
|
|
|
|
|
|
|
|
|
|
// 验证状态过滤
|
|
// 验证状态过滤
|
|
|
const response = await client.index.$get({
|
|
const response = await client.index.$get({
|
|
@@ -439,26 +348,18 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
|
|
|
|
|
describe('商品库存管理测试', () => {
|
|
describe('商品库存管理测试', () => {
|
|
|
it('应该正确处理商品库存更新', async () => {
|
|
it('应该正确处理商品库存更新', async () => {
|
|
|
- const dataSource = await IntegrationTestDatabase.getDataSource();
|
|
|
|
|
- const goodsRepository = dataSource.getRepository(Goods);
|
|
|
|
|
-
|
|
|
|
|
// 创建一个商品
|
|
// 创建一个商品
|
|
|
- const testGoods = goodsRepository.create({
|
|
|
|
|
|
|
+ const testGoods = await testFactory.createTestGoods(testUser.id, {
|
|
|
name: '库存测试商品',
|
|
name: '库存测试商品',
|
|
|
price: 100.00,
|
|
price: 100.00,
|
|
|
costPrice: 80.00,
|
|
costPrice: 80.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
categoryId2: testCategory.id,
|
|
categoryId2: testCategory.id,
|
|
|
categoryId3: testCategory.id,
|
|
categoryId3: testCategory.id,
|
|
|
- goodsType: 1,
|
|
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
|
- state: 1,
|
|
|
|
|
- stock: 100,
|
|
|
|
|
- lowestBuy: 1,
|
|
|
|
|
- createdBy: testUser.id
|
|
|
|
|
|
|
+ stock: 100
|
|
|
});
|
|
});
|
|
|
- await goodsRepository.save(testGoods);
|
|
|
|
|
|
|
|
|
|
// 更新库存
|
|
// 更新库存
|
|
|
const updateData = {
|
|
const updateData = {
|
|
@@ -485,43 +386,30 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
|
|
|
|
|
describe('管理员权限验证测试', () => {
|
|
describe('管理员权限验证测试', () => {
|
|
|
it('应该验证管理员可以访问所有数据', async () => {
|
|
it('应该验证管理员可以访问所有数据', async () => {
|
|
|
- const dataSource = await IntegrationTestDatabase.getDataSource();
|
|
|
|
|
- const goodsRepository = dataSource.getRepository(Goods);
|
|
|
|
|
-
|
|
|
|
|
// 创建多个用户的商品
|
|
// 创建多个用户的商品
|
|
|
- const userGoods = goodsRepository.create({
|
|
|
|
|
|
|
+ const userGoods = await testFactory.createTestGoods(testUser.id, {
|
|
|
name: '用户商品',
|
|
name: '用户商品',
|
|
|
price: 100.00,
|
|
price: 100.00,
|
|
|
costPrice: 80.00,
|
|
costPrice: 80.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
categoryId2: testCategory.id,
|
|
categoryId2: testCategory.id,
|
|
|
categoryId3: testCategory.id,
|
|
categoryId3: testCategory.id,
|
|
|
- goodsType: 1,
|
|
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
|
- state: 1,
|
|
|
|
|
- stock: 100,
|
|
|
|
|
- lowestBuy: 1,
|
|
|
|
|
- createdBy: testUser.id
|
|
|
|
|
|
|
+ stock: 100
|
|
|
});
|
|
});
|
|
|
- await goodsRepository.save(userGoods);
|
|
|
|
|
|
|
|
|
|
- const adminGoods = goodsRepository.create({
|
|
|
|
|
|
|
+ const adminGoods = await testFactory.createTestGoods(testAdmin.id, {
|
|
|
name: '管理员商品',
|
|
name: '管理员商品',
|
|
|
price: 200.00,
|
|
price: 200.00,
|
|
|
costPrice: 160.00,
|
|
costPrice: 160.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
categoryId2: testCategory.id,
|
|
categoryId2: testCategory.id,
|
|
|
categoryId3: testCategory.id,
|
|
categoryId3: testCategory.id,
|
|
|
- goodsType: 1,
|
|
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
|
- state: 1,
|
|
|
|
|
- stock: 50,
|
|
|
|
|
- lowestBuy: 1,
|
|
|
|
|
- createdBy: testAdmin.id
|
|
|
|
|
|
|
+ stock: 50
|
|
|
});
|
|
});
|
|
|
- await goodsRepository.save(adminGoods);
|
|
|
|
|
|
|
|
|
|
// 使用管理员token获取列表
|
|
// 使用管理员token获取列表
|
|
|
const response = await client.index.$get({
|
|
const response = await client.index.$get({
|