From 2120c08eb067f788d92300a34db50f1449c98104 Mon Sep 17 00:00:00 2001 From: Lucas Bustamante Date: Tue, 18 Jan 2022 19:36:18 -0300 Subject: [PATCH] Tests WIP --- .../__tests__/payload-transformer.spec.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/js/api/src/framework/__tests__/payload-transformer.spec.ts b/packages/js/api/src/framework/__tests__/payload-transformer.spec.ts index 748938be8b6..c7772ea5226 100644 --- a/packages/js/api/src/framework/__tests__/payload-transformer.spec.ts +++ b/packages/js/api/src/framework/__tests__/payload-transformer.spec.ts @@ -55,7 +55,13 @@ const jsonPayloadFull = JSON.stringify({ date_paid: 'Foo Date Paid', cart_hash: 'Foo Cart Hash', number: '1218', - meta_data: [], + meta_data: [ + { + id: 123, + key: "Foo Metadata Key 1", + value: "Foo Metadata Value 1" + } + ], line_items: [ { id: 6137, @@ -265,6 +271,14 @@ describe( 'OrderTransformer', () => { //expect(shipping.phone).toStrictEqual('Shipping Phone'); expect( createShippingAddressTransformer().fromModel(shipping) ).toStrictEqual(JSON.parse(jsonPayloadFull).shipping); + // Metadata + //expect(order.metaData).toHaveLength(1); + //expect(order.metaData[0]['id']).toStrictEqual(123); + //expect(order.metaData[0]['key']).toStrictEqual('Foo Metadata Key 1'); + //expect(order.metaData[0]['value']).toStrictEqual('Foo Metadata Value 1'); + // Line Items + console.log(order.lineItems); + expect(order.lineItems).toHaveLength(1); } ); } );