trading-platform/apps/backend/src/__tests__/jest-migration.test.ts

36 lines
979 B
TypeScript

/**
* Jest 30 Migration Test
*
* This test verifies that Jest 30 is working correctly after migration.
* It tests new features and ensures deprecated methods are not being used.
*/
describe('Jest 30 Migration', () => {
test('should pass with Jest 30', () => {
expect(true).toBe(true);
});
test('should support modern Jest matchers', () => {
const mockFn = jest.fn();
mockFn('test');
// Using toHaveBeenCalled instead of deprecated toBeCalled
expect(mockFn).toHaveBeenCalled();
expect(mockFn).toHaveBeenCalledWith('test');
});
test('should work with async tests', async () => {
const promise = Promise.resolve('success');
await expect(promise).resolves.toBe('success');
});
test('should support mock functions', () => {
const mockCallback = jest.fn((x) => x * 2);
[1, 2, 3].forEach(mockCallback);
expect(mockCallback).toHaveBeenCalledTimes(3);
expect(mockCallback.mock.results[0].value).toBe(2);
});
});