mirror of
https://github.com/hanzo-fi/stack.git
synced 2026-10-30 20:34:43 +00:00
42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
package suite
|
|
|
|
import (
|
|
"github.com/formancehq/formance-sdk-go/v2/pkg/models/operations"
|
|
. "github.com/formancehq/stack/tests/integration/internal"
|
|
"github.com/formancehq/stack/tests/integration/internal/modules"
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
"net/http"
|
|
)
|
|
|
|
var _ = WithModules([]*Module{modules.Ledger}, func() {
|
|
When("creating a ledger", func() {
|
|
BeforeEach(func() {
|
|
response, err := Client().Ledger.V2CreateLedger(TestContext(), operations.V2CreateLedgerRequest{
|
|
Ledger: "default",
|
|
})
|
|
Expect(err).To(BeNil())
|
|
Expect(response.StatusCode).To(Equal(http.StatusNoContent))
|
|
})
|
|
Then("updating metadata", func() {
|
|
m := map[string]string{
|
|
"foo": "bar",
|
|
}
|
|
BeforeEach(func() {
|
|
_, err := Client().Ledger.V2UpdateLedgerMetadata(TestContext(), operations.V2UpdateLedgerMetadataRequest{
|
|
Ledger: "default",
|
|
RequestBody: m,
|
|
})
|
|
Expect(err).To(BeNil())
|
|
})
|
|
It("should be ok", func() {
|
|
ledger, err := Client().Ledger.V2GetLedger(TestContext(), operations.V2GetLedgerRequest{
|
|
Ledger: "default",
|
|
})
|
|
Expect(err).To(BeNil())
|
|
Expect(ledger.V2GetLedgerResponse.Data.Metadata).To(Equal(m))
|
|
})
|
|
})
|
|
})
|
|
})
|