Passed
Push — main ( 2b8b96...6e7fbc )
by Acho
01:19
created

client.TestWebhookRequest_Order   A

Complexity

Conditions 1

Size

Total Lines 17
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 12
nop 1
dl 0
loc 17
rs 9.8
c 0
b 0
f 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