|
@@ -105,8 +105,8 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
price: 100.00,
|
|
price: 100.00,
|
|
|
costPrice: 80.00,
|
|
costPrice: 80.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
- categoryId2: 0,
|
|
|
|
|
- categoryId3: 0,
|
|
|
|
|
|
|
+ categoryId2: testCategory.id,
|
|
|
|
|
+ categoryId3: testCategory.id,
|
|
|
goodsType: 1,
|
|
goodsType: 1,
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
@@ -122,8 +122,8 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
price: 200.00,
|
|
price: 200.00,
|
|
|
costPrice: 160.00,
|
|
costPrice: 160.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
- categoryId2: 0,
|
|
|
|
|
- categoryId3: 0,
|
|
|
|
|
|
|
+ categoryId2: testCategory.id,
|
|
|
|
|
+ categoryId3: testCategory.id,
|
|
|
goodsType: 1,
|
|
goodsType: 1,
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
@@ -174,8 +174,8 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
price: 150.00,
|
|
price: 150.00,
|
|
|
costPrice: 120.00,
|
|
costPrice: 120.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
- categoryId2: 0,
|
|
|
|
|
- categoryId3: 0,
|
|
|
|
|
|
|
+ categoryId2: testCategory.id,
|
|
|
|
|
+ categoryId3: testCategory.id,
|
|
|
goodsType: 1,
|
|
goodsType: 1,
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
@@ -204,7 +204,7 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
const data = await response.json();
|
|
const data = await response.json();
|
|
|
expect(data).toHaveProperty('id');
|
|
expect(data).toHaveProperty('id');
|
|
|
expect(data.name).toBe(createData.name);
|
|
expect(data.name).toBe(createData.name);
|
|
|
- expect(data.price).toBe(createData.price);
|
|
|
|
|
|
|
+ expect(parseFloat(data.price)).toBe(createData.price);
|
|
|
expect(data.createdBy).toBe(testUser.id); // 验证可以指定创建人
|
|
expect(data.createdBy).toBe(testUser.id); // 验证可以指定创建人
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -239,8 +239,8 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
price: 100.00,
|
|
price: 100.00,
|
|
|
costPrice: 80.00,
|
|
costPrice: 80.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
- categoryId2: 0,
|
|
|
|
|
- categoryId3: 0,
|
|
|
|
|
|
|
+ categoryId2: testCategory.id,
|
|
|
|
|
+ categoryId3: testCategory.id,
|
|
|
goodsType: 1,
|
|
goodsType: 1,
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
@@ -293,8 +293,8 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
price: 100.00,
|
|
price: 100.00,
|
|
|
costPrice: 80.00,
|
|
costPrice: 80.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
- categoryId2: 0,
|
|
|
|
|
- categoryId3: 0,
|
|
|
|
|
|
|
+ categoryId2: testCategory.id,
|
|
|
|
|
+ categoryId3: testCategory.id,
|
|
|
goodsType: 1,
|
|
goodsType: 1,
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
@@ -327,7 +327,7 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
if (response.status === 200) {
|
|
if (response.status === 200) {
|
|
|
const data = await response.json();
|
|
const data = await response.json();
|
|
|
expect(data.name).toBe(updateData.name);
|
|
expect(data.name).toBe(updateData.name);
|
|
|
- expect(data.price).toBe(updateData.price);
|
|
|
|
|
|
|
+ expect(parseFloat(data.price)).toBe(updateData.price);
|
|
|
expect(data.state).toBe(updateData.state);
|
|
expect(data.state).toBe(updateData.state);
|
|
|
expect(data.updatedBy).toBe(testAdmin.id); // 验证可以指定更新人
|
|
expect(data.updatedBy).toBe(testAdmin.id); // 验证可以指定更新人
|
|
|
}
|
|
}
|
|
@@ -344,8 +344,8 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
price: 100.00,
|
|
price: 100.00,
|
|
|
costPrice: 80.00,
|
|
costPrice: 80.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
- categoryId2: 0,
|
|
|
|
|
- categoryId3: 0,
|
|
|
|
|
|
|
+ categoryId2: testCategory.id,
|
|
|
|
|
+ categoryId3: testCategory.id,
|
|
|
goodsType: 1,
|
|
goodsType: 1,
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
@@ -380,8 +380,8 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
price: 100.00,
|
|
price: 100.00,
|
|
|
costPrice: 80.00,
|
|
costPrice: 80.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
- categoryId2: 0,
|
|
|
|
|
- categoryId3: 0,
|
|
|
|
|
|
|
+ categoryId2: testCategory.id,
|
|
|
|
|
+ categoryId3: testCategory.id,
|
|
|
goodsType: 1,
|
|
goodsType: 1,
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
@@ -398,8 +398,8 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
price: 200.00,
|
|
price: 200.00,
|
|
|
costPrice: 160.00,
|
|
costPrice: 160.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
- categoryId2: 0,
|
|
|
|
|
- categoryId3: 0,
|
|
|
|
|
|
|
+ categoryId2: testCategory.id,
|
|
|
|
|
+ categoryId3: testCategory.id,
|
|
|
goodsType: 1,
|
|
goodsType: 1,
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
@@ -448,8 +448,8 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
price: 100.00,
|
|
price: 100.00,
|
|
|
costPrice: 80.00,
|
|
costPrice: 80.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
- categoryId2: 0,
|
|
|
|
|
- categoryId3: 0,
|
|
|
|
|
|
|
+ categoryId2: testCategory.id,
|
|
|
|
|
+ categoryId3: testCategory.id,
|
|
|
goodsType: 1,
|
|
goodsType: 1,
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
@@ -478,7 +478,7 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
|
|
|
|
|
if (response.status === 200) {
|
|
if (response.status === 200) {
|
|
|
const data = await response.json();
|
|
const data = await response.json();
|
|
|
- expect(data.stock).toBe(updateData.stock);
|
|
|
|
|
|
|
+ expect(parseInt(data.stock)).toBe(updateData.stock);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -494,8 +494,8 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
price: 100.00,
|
|
price: 100.00,
|
|
|
costPrice: 80.00,
|
|
costPrice: 80.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
- categoryId2: 0,
|
|
|
|
|
- categoryId3: 0,
|
|
|
|
|
|
|
+ categoryId2: testCategory.id,
|
|
|
|
|
+ categoryId3: testCategory.id,
|
|
|
goodsType: 1,
|
|
goodsType: 1,
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|
|
@@ -511,8 +511,8 @@ describe('管理员商品管理API集成测试', () => {
|
|
|
price: 200.00,
|
|
price: 200.00,
|
|
|
costPrice: 160.00,
|
|
costPrice: 160.00,
|
|
|
categoryId1: testCategory.id,
|
|
categoryId1: testCategory.id,
|
|
|
- categoryId2: 0,
|
|
|
|
|
- categoryId3: 0,
|
|
|
|
|
|
|
+ categoryId2: testCategory.id,
|
|
|
|
|
+ categoryId3: testCategory.id,
|
|
|
goodsType: 1,
|
|
goodsType: 1,
|
|
|
supplierId: testSupplier.id,
|
|
supplierId: testSupplier.id,
|
|
|
merchantId: testMerchant.id,
|
|
merchantId: testMerchant.id,
|