Skip to content
Merged
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
10 changes: 10 additions & 0 deletions services/api/__mocks__/bcryptjs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Real bcrypt at the production cost of 12 takes ~200ms per hash or compare,
// which dominates the auth tests. 4 is the minimum cost bcrypt accepts.

const { default: bcrypt } = await vi.importActual('bcryptjs');

function genSalt() {
return bcrypt.genSalt(4);
}

export default { ...bcrypt, genSalt };
1 change: 1 addition & 0 deletions services/api/src/utils/testing/setup/mocks.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Replaces these packages with their counterparts in __mocks__.
vi.mock('@google-cloud/storage');
vi.mock('@simplewebauthn/server');
vi.mock('bcryptjs');
vi.mock('firebase-admin');
vi.mock('google-auth-library');
vi.mock('postmark');
Expand Down
Loading