Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade test packages to jest #19

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
};
6 changes: 3 additions & 3 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ export class MongoAdapter extends Adapter {
if (!ObjectId.isValid(offset)) {
return Promise.reject("invalid offset");
}
debug("restoring session: %s", pid);
debug("restoring session: {pid: %s, offset: %s}", pid, offset);
const eventOffset = new ObjectId(offset);

let results;
Expand All @@ -821,11 +821,11 @@ export class MongoAdapter extends Adapter {
return Promise.reject("error while fetching session");
}

if (!results[0].value || !results[1]) {
if (!results[0] || !results[1]) {
return Promise.reject("session or offset not found");
}

const session = results[0].value.data;
const session = results[0].data;

// could use a sparse index on [_id, nsp, data.opts.rooms, data.opts.except] (only index the documents whose type is EventType.BROADCAST)
const cursor = this.mongoCollection.find({
Expand Down
Loading