Total Lines | 27 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | package client |
||
2 | |||
3 | import ( |
||
4 | "encoding/json" |
||
5 | "testing" |
||
6 | |||
7 | "github.com/NdoleStudio/lemonsqueezy-go/internal/stubs" |
||
8 | "github.com/stretchr/testify/assert" |
||
9 | ) |
||
10 | |||
11 | func TestWebhookRequest_Order(t *testing.T) { |
||
12 | // Setup |
||
13 | t.Parallel() |
||
14 | |||
15 | var request WebhookRequestOrder |
||
16 | err := json.Unmarshal(stubs.WebhookRequestOrderCreated(), &request) |
||
17 | assert.Nil(t, err) |
||
18 | |||
19 | assert.Equal(t, WebhookRequestMeta{ |
||
20 | EventName: "order_created", |
||
21 | TestMode: false, |
||
22 | CustomData: map[string]any{ |
||
23 | "customer_id": float64(25), |
||
24 | }, |
||
25 | }, request.Meta) |
||
26 | |||
27 | assert.Equal(t, "89b36d62-4f5c-4353-853f-0c769d0535c8", request.Data.Attributes.Identifier) |
||
28 | } |
||
29 |