fix: add metadata to product type resp (#9515)

This commit is contained in:
Sebastian Rindom
2024-10-09 16:22:51 +02:00
committed by GitHub
parent 4daf57dc1f
commit 7ec174309a
2 changed files with 37 additions and 6 deletions
@@ -44,12 +44,20 @@ medusaIntegrationTestRunner({
expect(res.status).toEqual(200) expect(res.status).toEqual(200)
expect(res.data.product_types).toEqual( expect(res.data.product_types).toEqual(
expect.arrayContaining([ expect.arrayContaining([
expect.objectContaining({ {
id: expect.stringMatching(/ptyp_.{24}/),
value: "test1", value: "test1",
}), created_at: expect.any(String),
expect.objectContaining({ updated_at: expect.any(String),
metadata: null,
},
{
id: expect.stringMatching(/ptyp_.{24}/),
value: "test2", value: "test2",
}), created_at: expect.any(String),
updated_at: expect.any(String),
metadata: null,
},
]) ])
) )
}) })
@@ -61,13 +69,35 @@ medusaIntegrationTestRunner({
// The value of the type should match the search param // The value of the type should match the search param
expect(res.data.product_types).toEqual([ expect(res.data.product_types).toEqual([
expect.objectContaining({ {
id: expect.stringMatching(/ptyp_.{24}/),
value: "test1", value: "test1",
}), created_at: expect.any(String),
updated_at: expect.any(String),
metadata: null,
},
]) ])
}) })
// BREAKING: Removed a test around filtering based on discount condition id, which is no longer supported // BREAKING: Removed a test around filtering based on discount condition id, which is no longer supported
}) })
describe("/admin/product-types/:id", () => {
it("returns a product type", async () => {
const res = await api.get(
`/admin/product-types/${type1.id}`,
adminHeaders
)
expect(res.status).toEqual(200)
expect(res.data.product_type).toEqual({
id: expect.stringMatching(/ptyp_.{24}/),
value: "test1",
created_at: expect.any(String),
updated_at: expect.any(String),
metadata: null,
})
})
})
}, },
}) })
@@ -3,6 +3,7 @@ export const defaultAdminProductTypeFields = [
"value", "value",
"created_at", "created_at",
"updated_at", "updated_at",
"metadata",
] ]
export const retrieveProductTypeTransformQueryConfig = { export const retrieveProductTypeTransformQueryConfig = {