Skip to content

Commit

Permalink
pipeline test
Browse files Browse the repository at this point in the history
  • Loading branch information
ricsam committed Dec 12, 2024
1 parent b98c7ac commit a3ea4ec
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/backends/s3/mock-s3.test.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
import { S3Client } from '@aws-sdk/client-s3';
import {
afterEach,
beforeEach,
describe,
expect,
it,
jest,
mock,
spyOn,
} from 'bun:test';
import { createS3Fs } from './s3';

describe('s3Fs with mocked client', () => {

let mockSend: jest.Mock;
let spy: jest.Mock;

beforeEach(async () => {
mock.module('./create-s3-client', () => {
const fn = jest.fn();
return { createS3Client: fn };
});
const { createS3Client } = await import('./create-s3-client');
mockSend = jest.fn();
(createS3Client as jest.Mock).mockReturnValue({
send: mockSend,
const m = await import('./create-s3-client');
spy = spyOn(m, 'createS3Client').mockImplementation((): S3Client => {
mockSend = jest.fn();
return { send: mockSend } as any;
});
});

afterEach(() => {
jest.clearAllMocks();
mock.restore();
spy.mockRestore();
jest.restoreAllMocks();
});

it('should write a text file', async () => {
Expand Down

0 comments on commit a3ea4ec

Please sign in to comment.