fix(samples): fix test case (#903)
This commit is contained in:
parent
d777fede90
commit
418256820d
@ -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: {
|
||||||
|
@ -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'
|
||||||
}
|
}
|
||||||
|
@ -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'
|
||||||
}
|
}
|
||||||
|
@ -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: {
|
||||||
|
Loading…
Reference in New Issue
Block a user