|
1
|
import { medusaIntegrationTestRunner } from "@medusajs/test-utils" |
|
2
|
import { |
|
3
|
generatePublishableKey, |
|
4
|
generateStoreHeaders, |
|
5
|
} from "../../../../helpers/create-admin-user" |
|
6
|
|
|
7
|
jest.setTimeout(50000) |
|
8
|
|
|
9
|
const env = {} |
|
10
|
|
|
11
|
medusaIntegrationTestRunner({ |
|
12
|
env, |
|
13
|
testSuite: ({ api, getContainer }) => { |
|
14
|
describe("Currency - Store", () => { |
|
15
|
it("should correctly retrieve and list currencies", async () => { |
|
16
|
const publishableKey = await generatePublishableKey(getContainer()) |
|
17
|
const storeHeaders = generateStoreHeaders({ publishableKey }) |
|
18
|
|
|
19
|
const listResp = await api.get("/store/currencies", storeHeaders) |
|
20
|
|
|
21
|
expect(listResp.data.currencies).toEqual( |
|
22
|
expect.arrayContaining([ |
|
23
|
expect.objectContaining({ |
|
24
|
code: "aud", |
|
25
|
}), |
|
26
|
expect.objectContaining({ |
|
27
|
code: "cad", |
|
28
|
}), |
|
29
|
]) |
|
30
|
) |
|
31
|
|
|
32
|
const retrieveResp = await api.get( |
|
33
|
`/store/currencies/aud`, |
|
34
|
storeHeaders |
|
35
|
) |
|
36
|
expect(retrieveResp.data.currency).toEqual( |
|
37
|
listResp.data.currencies.find((c) => c.code === "aud") |
|
38
|
) |
|
39
|
}) |
|
40
|
}) |
|
41
|
}, |
|
42
|
}) |