-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.setup.js
33 lines (28 loc) · 889 Bytes
/
jest.setup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { jest } from '@jest/globals';
jest.mock('bcrypt', () => ({
genSalt: jest.fn().mockResolvedValue('salt'),
hash: jest.fn().mockResolvedValue('hashedPassword'),
compare: jest.fn().mockResolvedValue(true),
}));
jest.mock('web3', () => ({
Web3: jest.fn().mockImplementation(() => ({
eth: {
Contract: jest.fn().mockReturnValue({
methods: {
tokenURI: jest.fn().mockReturnValue({
call: jest.fn().mockResolvedValue('https://example.com/token/1'),
}),
},
}),
},
})),
}));
global.fetch = jest.fn(() =>
Promise.resolve({
json: () => Promise.resolve({ name: 'Test NFT', description: 'A test NFT', image: 'https://example.com/image.png' }),
})
);
// Add any other global mocks or setup here
jest.mock('./server/middleware/requireAuth.js', () => ({
requireAuth: jest.fn((req, res, next) => next()),
}));