feat: Add support for search to all endpoints (#7149)
* feat: Add search capability to api keys * feat: Add support for searching to currency and customer endpoints * fix: Clean up product search filters * feat: Add search support to regions * feat: Add search support to sales channels * feat: Add search support to store module * feat: Add search support to user module * fix: Clean up inventory search * feat: Add search support for payments * fix: Add searchable attributes to stock location models * feat: Add search support to tax * feat: Add search support to promotions * feat: Add search support for pricing, filtering cleanup * fix: Further cleanups around search
This commit is contained in:
1 parent
d02905cefa
commit
f03a822253
52 files changed
+640
-64
No files matched your search
@@ -64,6 +64,33 @@ medusaIntegrationTestRunner({
|
||||
})
|
||||
})
|
||||
|
||||
it("can search through tax rates", async () => {
|
||||
const region = await service.createTaxRegions({
|
||||
country_code: "us",
|
||||
})
|
||||
|
||||
await service.create({
|
||||
tax_region_id: region.id,
|
||||
code: "low",
|
||||
rate: 2.5,
|
||||
name: "low rate",
|
||||
})
|
||||
|
||||
await service.create({
|
||||
tax_region_id: region.id,
|
||||
code: "high",
|
||||
rate: 5,
|
||||
name: "high rate",
|
||||
})
|
||||
|
||||
const response = await api.get(`/admin/tax-rates?q=high`, adminHeaders)
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.tax_rates).toEqual(
|
||||
expect.arrayContaining([expect.objectContaining({ code: "high" })])
|
||||
)
|
||||
})
|
||||
|
||||
it("can create a tax region with rates and rules", async () => {
|
||||
const regionRes = await api.post(
|
||||
`/admin/tax-regions`,
|
||||
@@ -402,6 +429,31 @@ medusaIntegrationTestRunner({
|
||||
})
|
||||
})
|
||||
|
||||
it("can search through tax regions", async () => {
|
||||
await service.createTaxRegions([
|
||||
{
|
||||
country_code: "us",
|
||||
province_code: "texas",
|
||||
},
|
||||
{
|
||||
country_code: "us",
|
||||
province_code: "florida",
|
||||
},
|
||||
])
|
||||
|
||||
const response = await api.get(`/admin/tax-regions?q=ida`, adminHeaders)
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.tax_regions).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
country_code: "us",
|
||||
province_code: "florida",
|
||||
}),
|
||||
])
|
||||
)
|
||||
})
|
||||
|
||||
it("can create a tax region and delete it", async () => {
|
||||
const regionRes = await api.post(
|
||||
`/admin/tax-regions`,
|
||||
|
||||
Reference in new issue
Block a user