Skip to content

Commit fd73527

Browse files
committed
Release vintasend-aws-s3-attachments@0.9.1
1 parent 813451f commit fd73527

4 files changed

Lines changed: 36 additions & 29 deletions

File tree

jest.config.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

package.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
{
22
"name": "vintasend-aws-s3-attachments",
3-
"version": "0.9.0",
3+
"version": "0.9.1",
44
"description": "Implementation of AWS S3 Attachments for VintaSend",
55
"main": "dist/index.js",
66
"scripts": {
77
"build": "tsc",
88
"prepublishOnly": "npm run build",
9-
"test": "jest",
10-
"test:watch": "jest --watch",
11-
"test:coverage": "jest --coverage"
9+
"test": "vitest run",
10+
"test:watch": "vitest",
11+
"test:coverage": "vitest run --coverage"
1212
},
1313
"files": [
1414
"dist"
1515
],
1616
"author": "Hugo Bessa",
1717
"license": "MIT",
1818
"dependencies": {
19-
"@aws-sdk/client-s3": "^3.981.0",
20-
"@aws-sdk/s3-request-presigner": "^3.981.0",
21-
"vintasend": "^0.9.0"
19+
"@aws-sdk/client-s3": "^3.1000.0",
20+
"@aws-sdk/s3-request-presigner": "^3.1000.0",
21+
"vintasend": "^0.9.1"
2222
},
2323
"devDependencies": {
24-
"@types/jest": "^30.0.0",
25-
"jest": "^30.2.0",
26-
"ts-jest": "^29.4.6",
27-
"typescript": "^5.9.3"
24+
"@vitest/coverage-v8": "^4.0.18",
25+
"typescript": "^5.9.3",
26+
"vitest": "^4.0.18"
2827
}
2928
}

src/__tests__/attachment-manager.test.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import type { S3AttachmentManagerConfig } from '../aws-s3-attachment-manager';
33
import { S3Client, PutObjectCommand, GetObjectCommand, DeleteObjectCommand } from '@aws-sdk/client-s3';
44
import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
55
import { Readable } from 'node:stream';
6+
import { vi } from 'vitest';
67

78
// Mock AWS SDK
8-
jest.mock('@aws-sdk/client-s3');
9-
jest.mock('@aws-sdk/s3-request-presigner');
9+
vi.mock('@aws-sdk/client-s3');
10+
vi.mock('@aws-sdk/s3-request-presigner');
1011

1112
describe('S3AttachmentManager', () => {
1213
let manager: S3AttachmentManager;
@@ -18,15 +19,17 @@ describe('S3AttachmentManager', () => {
1819
};
1920

2021
beforeEach(() => {
21-
jest.clearAllMocks();
22+
vi.clearAllMocks();
2223

2324
// Create mock S3Client
2425
mockS3Client = {
25-
send: jest.fn(),
26+
send: vi.fn(),
2627
config: { region: 'us-east-1' },
2728
};
2829

29-
(S3Client as jest.MockedClass<typeof S3Client>).mockImplementation(() => mockS3Client);
30+
vi.mocked(S3Client).mockImplementation(function () {
31+
return mockS3Client as never;
32+
});
3033

3134
manager = new S3AttachmentManager(testConfig);
3235
});
@@ -190,7 +193,7 @@ describe('S3AttachmentManager', () => {
190193

191194
it('should handle file path string input', async () => {
192195
const fs = require('node:fs/promises');
193-
jest.spyOn(fs, 'readFile').mockResolvedValue(Buffer.from('file content'));
196+
vi.spyOn(fs, 'readFile').mockResolvedValue(Buffer.from('file content'));
194197

195198
mockS3Client.send.mockResolvedValueOnce({} as any);
196199

@@ -328,7 +331,7 @@ describe('S3AttachmentManager', () => {
328331

329332
describe('url', () => {
330333
it('should generate presigned URL with default expiration', async () => {
331-
(getSignedUrl as jest.Mock).mockResolvedValue('https://signed-url.example.com');
334+
vi.mocked(getSignedUrl).mockResolvedValue('https://signed-url.example.com');
332335

333336
const url = await attachmentFile.url();
334337

@@ -341,7 +344,7 @@ describe('S3AttachmentManager', () => {
341344
});
342345

343346
it('should generate presigned URL with custom expiration', async () => {
344-
(getSignedUrl as jest.Mock).mockResolvedValue('https://signed-url.example.com');
347+
vi.mocked(getSignedUrl).mockResolvedValue('https://signed-url.example.com');
345348

346349
const url = await attachmentFile.url(7200);
347350

vitest.config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { defineConfig } from 'vitest/config';
2+
3+
export default defineConfig({
4+
test: {
5+
environment: 'node',
6+
globals: true,
7+
include: ['**/__tests__/**/*.test.ts'],
8+
coverage: {
9+
provider: 'v8',
10+
reportsDirectory: 'coverage',
11+
include: ['src/**/*.ts'],
12+
exclude: ['src/**/*.d.ts', 'src/**/__tests__/**'],
13+
},
14+
},
15+
});

0 commit comments

Comments
 (0)