refactor(api): extract dashboard procedures
This commit is contained in:
@@ -348,8 +348,28 @@ describe("dashboard router", () => {
|
||||
describe("getTopValueResources", () => {
|
||||
it("returns sorted resources with default limit", async () => {
|
||||
const resources = [
|
||||
{ id: "res_1", displayName: "Alice", valueScore: 95 },
|
||||
{ id: "res_2", displayName: "Bob", valueScore: 88 },
|
||||
{
|
||||
id: "res_1",
|
||||
eid: "alice",
|
||||
displayName: "Alice",
|
||||
chapter: "Delivery",
|
||||
valueScore: 95,
|
||||
lcrCents: 12_300,
|
||||
countryCode: "DE",
|
||||
federalState: "BY",
|
||||
metroCityName: "Munich",
|
||||
},
|
||||
{
|
||||
id: "res_2",
|
||||
eid: "bob",
|
||||
displayName: "Bob",
|
||||
chapter: "Data",
|
||||
valueScore: 88,
|
||||
lcrCents: 10_800,
|
||||
countryCode: "US",
|
||||
federalState: "CA",
|
||||
metroCityName: "San Francisco",
|
||||
},
|
||||
];
|
||||
|
||||
vi.mocked(getDashboardTopValueResources).mockResolvedValue(resources);
|
||||
@@ -357,7 +377,7 @@ describe("dashboard router", () => {
|
||||
const caller = createControllerCaller({});
|
||||
const result = await caller.getTopValueResources({ limit: 10 });
|
||||
|
||||
expect(result).toHaveLength(2);
|
||||
expect(result).toEqual(resources);
|
||||
expect(getDashboardTopValueResources).toHaveBeenCalledWith(
|
||||
expect.anything(),
|
||||
expect.objectContaining({ limit: 10 }),
|
||||
@@ -576,6 +596,9 @@ describe("dashboard router", () => {
|
||||
chapter: "Delivery",
|
||||
valueScore: 91,
|
||||
lcrCents: 9_500,
|
||||
countryCode: "DE",
|
||||
federalState: "BY",
|
||||
metroCityName: "Augsburg",
|
||||
},
|
||||
]);
|
||||
vi.mocked(getDashboardDemand).mockResolvedValue([
|
||||
@@ -620,6 +643,9 @@ describe("dashboard router", () => {
|
||||
chapter: "Delivery",
|
||||
lcr: "95,00 EUR",
|
||||
valueScore: 91,
|
||||
countryCode: "DE",
|
||||
federalState: "BY",
|
||||
metroCityName: "Augsburg",
|
||||
},
|
||||
],
|
||||
demandPipeline: [
|
||||
|
||||
Reference in New Issue
Block a user