From e0c10a06b1a1f2f91676f6846c4cf80af9e80b83 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sat, 5 Sep 2020 18:09:48 +0530 Subject: allow inline locations --- packages/taler-wallet-core/src/types/types-test.ts | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'packages/taler-wallet-core/src/types/types-test.ts') diff --git a/packages/taler-wallet-core/src/types/types-test.ts b/packages/taler-wallet-core/src/types/types-test.ts index afdc01844..183122ef7 100644 --- a/packages/taler-wallet-core/src/types/types-test.ts +++ b/packages/taler-wallet-core/src/types/types-test.ts @@ -53,3 +53,42 @@ test("contract terms validation", (t) => { t.fail(); }); + + +test("contract terms validation (locations)", (t) => { + const c = { + nonce: "123123123", + h_wire: "123", + amount: "EUR:1.5", + auditors: [], + exchanges: [{ master_pub: "foo", url: "foo" }], + fulfillment_url: "foo", + max_fee: "EUR:1.5", + merchant_pub: "12345", + merchant: { + name: "Foo", + address: { + country: "DE", + } + }, + order_id: "test_order", + pay_deadline: { t_ms: 42 }, + wire_transfer_deadline: { t_ms: 42 }, + merchant_base_url: "https://example.com/pay", + products: [], + refund_deadline: { t_ms: 42 }, + summary: "hello", + timestamp: { t_ms: 42 }, + wire_method: "test", + delivery_location: { + country: "FR", + town: "Rennes", + } + }; + + const r = codecForContractTerms().decode(c); + + t.assert(r.merchant.address?.country === "DE"); + t.assert(r.delivery_location?.country === "FR"); + t.assert(r.delivery_location?.town === "Rennes"); +}); -- cgit v1.2.3