Skip to content

Commit a2f1cca

Browse files
committed
🩹 server: simple fallback for missing asset symbol
1 parent 5bb0587 commit a2f1cca

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

‎server/test/hooks/activity.test.ts‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,40 @@ describe("address activity", () => {
783783
expect(response.status).toBe(200);
784784
});
785785

786+
it("sends translated notification without symbol when asset is missing", async () => {
787+
const sendPushNotification = vi.spyOn(onesignal, "sendPushNotification");
788+
789+
const { asset: _, ...tokenWithoutAsset } = activityPayload.json.event.activity[1];
790+
const response = await appClient.index.$post({
791+
...activityPayload,
792+
json: {
793+
...activityPayload.json,
794+
event: {
795+
...activityPayload.json.event,
796+
activity: [
797+
{
798+
...tokenWithoutAsset,
799+
toAddress: account,
800+
rawContract: { ...activityPayload.json.event.activity[1].rawContract, address: inject("WETH") },
801+
},
802+
],
803+
},
804+
},
805+
});
806+
807+
await vi.waitUntil(() => sendPushNotification.mock.calls.length > 0);
808+
809+
expect(sendPushNotification).toHaveBeenCalledWith({
810+
userId: account,
811+
headings: { en: "Funds received", es: "Fondos recibidos" }, // cspell:ignore Fondos recibidos
812+
contents: {
813+
en: "99.973 received and instantly started earning yield",
814+
es: "99.973 recibidos y empezaron a generar rendimiento", // cspell:ignore recibidos empezaron generar rendimiento
815+
},
816+
});
817+
expect(response.status).toBe(200);
818+
});
819+
786820
it("doesn't send a notification for market shares", async () => {
787821
const sendPushNotification = vi.spyOn(onesignal, "sendPushNotification");
788822

0 commit comments

Comments
 (0)