fix(samples): fix test case (#903)

This commit is contained in:
Junyi 2022-10-13 13:50:11 +08:00 committed by GitHub
parent d777fede90
commit 418256820d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View File

@ -217,11 +217,11 @@ export default class ShopPlugin extends Plugin {
name: 'orders', name: 'orders',
actions: { actions: {
async deliver(ctx, next) { async deliver(ctx, next) {
const { resourceIndex } = ctx.action.params; const { filterByTk } = ctx.action.params;
const orderRepo = ctx.db.getRepository('orders'); const orderRepo = ctx.db.getRepository('orders');
const [order] = await orderRepo.update({ const [order] = await orderRepo.update({
filterByTk: resourceIndex, filterByTk,
values: { values: {
status: 2, status: 2,
delivery: { delivery: {

View File

@ -132,8 +132,8 @@ describe('shop actions', () => {
expect(order.data.status).toEqual(0); expect(order.data.status).toEqual(0);
const { body: deliveredOrder } = await agent.resource('orders').deliver({ const { body: deliveredOrder } = await agent.resource('orders').deliver({
filterByTk: order.data.id,
values: { values: {
orderId: order.data.id,
provider: 'SF', provider: 'SF',
trackingNumber: '123456789' trackingNumber: '123456789'
} }

View File

@ -40,8 +40,8 @@ describe('shop actions', () => {
expect(order.data.status).toEqual(0); expect(order.data.status).toEqual(0);
const { body: deliveredOrder } = await agent.resource('orders').deliver({ const { body: deliveredOrder } = await agent.resource('orders').deliver({
filterByTk: order.data.id,
values: { values: {
orderId: order.data.id,
provider: 'SF', provider: 'SF',
trackingNumber: '123456789' trackingNumber: '123456789'
} }

View File

@ -72,11 +72,11 @@ export class ShopPlugin extends Plugin {
fields: ['id', 'status', 'createdAt', 'updatedAt'] fields: ['id', 'status', 'createdAt', 'updatedAt']
}, },
async deliver(ctx, next) { async deliver(ctx, next) {
const { resourceIndex } = ctx.action.params; const { filterByTk } = ctx.action.params;
const orderRepo = ctx.db.getRepository('orders'); const orderRepo = ctx.db.getRepository('orders');
const [order] = await orderRepo.update({ const [order] = await orderRepo.update({
filterByTk: resourceIndex, filterByTk,
values: { values: {
status: 2, status: 2,
delivery: { delivery: {