feat: filter exports by spread thresholds
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
buildSpreadInfoUrl,
|
||||
createSpreadInfoClient,
|
||||
DEFAULT_SPREAD_INFO_CONFIGS,
|
||||
matchesSpreadThresholds,
|
||||
mapSpreadInfoResponse
|
||||
} from "../src/content/market/spread-info";
|
||||
|
||||
@@ -165,4 +166,49 @@ describe("spread-info", () => {
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
test("matches thresholds using display values and requires every filled threshold", () => {
|
||||
expect(
|
||||
matchesSpreadThresholds(
|
||||
{
|
||||
averageDuration: "56",
|
||||
finishRate: "28.24%",
|
||||
interactionRate: "4.02%",
|
||||
playMedian: "10913233"
|
||||
},
|
||||
{
|
||||
averageDuration: 50,
|
||||
finishRate: 28,
|
||||
interactionRate: 4,
|
||||
playMedian: 10000000
|
||||
}
|
||||
)
|
||||
).toBe(true);
|
||||
|
||||
expect(
|
||||
matchesSpreadThresholds(
|
||||
{
|
||||
averageDuration: "56",
|
||||
finishRate: "28.24%",
|
||||
interactionRate: "4.02%",
|
||||
playMedian: "10913233"
|
||||
},
|
||||
{
|
||||
averageDuration: 57
|
||||
}
|
||||
)
|
||||
).toBe(false);
|
||||
|
||||
expect(
|
||||
matchesSpreadThresholds(
|
||||
{
|
||||
finishRate: "28.24%"
|
||||
},
|
||||
{
|
||||
finishRate: 20,
|
||||
interactionRate: 1
|
||||
}
|
||||
)
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user