From 418256820d0b4aed6c50705d2cc9dc8ae761c60c Mon Sep 17 00:00:00 2001 From: Junyi Date: Thu, 13 Oct 2022 13:50:11 +0800 Subject: [PATCH] fix(samples): fix test case (#903) --- docs/zh-CN/development/guide/resources-actions.md | 4 ++-- docs/zh-CN/development/others/testing.md | 2 +- packages/samples/shop-actions/__tests__/server/index.test.ts | 2 +- packages/samples/shop-actions/src/server/index.ts | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/zh-CN/development/guide/resources-actions.md b/docs/zh-CN/development/guide/resources-actions.md index d7bca4402..ef36470b7 100644 --- a/docs/zh-CN/development/guide/resources-actions.md +++ b/docs/zh-CN/development/guide/resources-actions.md @@ -217,11 +217,11 @@ export default class ShopPlugin extends Plugin { name: 'orders', actions: { async deliver(ctx, next) { - const { resourceIndex } = ctx.action.params; + const { filterByTk } = ctx.action.params; const orderRepo = ctx.db.getRepository('orders'); const [order] = await orderRepo.update({ - filterByTk: resourceIndex, + filterByTk, values: { status: 2, delivery: { diff --git a/docs/zh-CN/development/others/testing.md b/docs/zh-CN/development/others/testing.md index 49300ee59..1f37805b5 100644 --- a/docs/zh-CN/development/others/testing.md +++ b/docs/zh-CN/development/others/testing.md @@ -132,8 +132,8 @@ describe('shop actions', () => { expect(order.data.status).toEqual(0); const { body: deliveredOrder } = await agent.resource('orders').deliver({ + filterByTk: order.data.id, values: { - orderId: order.data.id, provider: 'SF', trackingNumber: '123456789' } diff --git a/packages/samples/shop-actions/__tests__/server/index.test.ts b/packages/samples/shop-actions/__tests__/server/index.test.ts index 12956db08..479562523 100644 --- a/packages/samples/shop-actions/__tests__/server/index.test.ts +++ b/packages/samples/shop-actions/__tests__/server/index.test.ts @@ -40,8 +40,8 @@ describe('shop actions', () => { expect(order.data.status).toEqual(0); const { body: deliveredOrder } = await agent.resource('orders').deliver({ + filterByTk: order.data.id, values: { - orderId: order.data.id, provider: 'SF', trackingNumber: '123456789' } diff --git a/packages/samples/shop-actions/src/server/index.ts b/packages/samples/shop-actions/src/server/index.ts index 689563127..f3fa4bd61 100644 --- a/packages/samples/shop-actions/src/server/index.ts +++ b/packages/samples/shop-actions/src/server/index.ts @@ -72,11 +72,11 @@ export class ShopPlugin extends Plugin { fields: ['id', 'status', 'createdAt', 'updatedAt'] }, async deliver(ctx, next) { - const { resourceIndex } = ctx.action.params; + const { filterByTk } = ctx.action.params; const orderRepo = ctx.db.getRepository('orders'); const [order] = await orderRepo.update({ - filterByTk: resourceIndex, + filterByTk, values: { status: 2, delivery: {