Allow partial market rates in CSV export
This commit is contained in:
@@ -33,12 +33,10 @@ describe("market-api-client", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("returns a missing-rate failure when the payload omits a required field", () => {
|
||||
test("returns a missing-rate failure when the payload omits both rate fields", () => {
|
||||
expect(
|
||||
mapAuthorAseInfoResponse({
|
||||
data: {
|
||||
avg_search_after_view_rate: "<0.02%"
|
||||
}
|
||||
data: {}
|
||||
})
|
||||
).toMatchObject({
|
||||
success: false,
|
||||
@@ -46,6 +44,21 @@ describe("market-api-client", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("maps a partially populated payload into partial rates", () => {
|
||||
expect(
|
||||
mapAuthorAseInfoResponse({
|
||||
data: {
|
||||
personal_avg_search_after_view_rate: "0.02 - 0.1%"
|
||||
}
|
||||
})
|
||||
).toMatchObject({
|
||||
success: true,
|
||||
rates: {
|
||||
personalVideoAfterSearchRate: "0.02% - 0.1%"
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test("returns a request-failed result for non-ok responses", async () => {
|
||||
const client = createMarketApiClient({
|
||||
fetchImpl: async () => ({
|
||||
|
||||
Reference in New Issue
Block a user