Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
aodinok committed Apr 26, 2024
1 parent 7a7e622 commit db28d8e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
10 changes: 5 additions & 5 deletions __tests__/functions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ jest.mock("firebase-admin", () => ({

jest.mock("messagebird", () => ({
initClient: () => ({
conversations: {
start: (payload, callback) => {
callback(null, { id: "fakeConversationsResponse" });
conversations: {
start: (payload, callback) => {
callback(null, { id: "fakeConversationsResponse" });
},
},
},
})
}),
}));

describe("firestore-messagebird-send-msg", () => {
Expand Down
12 changes: 7 additions & 5 deletions functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ function initialize() {
logInfo("initializing db...");
db = admin.firestore();
logInfo("initializing mb api client...");
mb = messagebird.initClient(config.accessKey, undefined, ["ENABLE_FIREBASE_PLUGIN"]);
mb = messagebird.initClient(config.accessKey, undefined, [
"ENABLE_FIREBASE_PLUGIN",
]);
logInfo("initialization finished successfully");
}

Expand Down Expand Up @@ -164,14 +166,14 @@ async function processWrite(
}
}

export const processQueue = functions.firestore.document(config.msgCollection + '/{msgId}').onWrite(
async (change) => {
export const processQueue = functions.firestore
.document(config.msgCollection + "/{msgId}")
.onWrite(async (change) => {
initialize();
try {
await processWrite(change);
} catch (err) {
logWarn("unexpected error during execution: ", err);
return null;
}
}
);
});

0 comments on commit db28d8e

Please sign in to comment.