feat: Implement trip invitation functionality and notification handling
- Added TripInvitationRepository for managing trip invitations. - Created TripInvitation model with serialization methods. - Implemented notification payload parser for handling FCM notifications. - Enhanced NotificationService to manage trip invitations and related actions. - Updated UserRepository to include user search functionality. - Modified AuthRepository to store multiple FCM tokens. - Added tests for trip invitation logic and notification payload parsing. - Updated pubspec.yaml and pubspec.lock for dependency management.
This commit is contained in:
24
functions/notification_tokens.test.js
Normal file
24
functions/notification_tokens.test.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const test = require("node:test");
|
||||
const assert = require("node:assert/strict");
|
||||
const { extractUserFcmTokens } = require("./notification_tokens");
|
||||
|
||||
test("extractUserFcmTokens supports legacy single token", () => {
|
||||
const tokens = extractUserFcmTokens({ fcmToken: "token_1" });
|
||||
assert.deepEqual(tokens, ["token_1"]);
|
||||
});
|
||||
|
||||
test("extractUserFcmTokens merges single and multi token formats", () => {
|
||||
const tokens = extractUserFcmTokens({
|
||||
fcmToken: "token_legacy",
|
||||
fcmTokens: ["token_a", "token_b"],
|
||||
});
|
||||
assert.deepEqual(tokens, ["token_legacy", "token_a", "token_b"]);
|
||||
});
|
||||
|
||||
test("extractUserFcmTokens filters invalid values", () => {
|
||||
const tokens = extractUserFcmTokens({
|
||||
fcmToken: "",
|
||||
fcmTokens: ["valid", null, 42, ""],
|
||||
});
|
||||
assert.deepEqual(tokens, ["valid"]);
|
||||
});
|
||||
Reference in New Issue
Block a user