Skip to content

Commit

Permalink
remove duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
gnaaruag committed Jul 28, 2024
1 parent fc8c2c6 commit dc54f0b
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions sample/04-file-upload/test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,4 @@ describe('AppController (e2e)', () => {
.expect(200)
.expect('Hello World from file upload.');
});

it('/files/upload-file (POST); for file with content', async () => {
const mockDestination = 'uploads';
const mockFilename = 'content.txt';

const response = await request(app.getHttpServer())
.post(
`/files/upload-file?destination=${mockDestination}&filename=${mockFilename}`,
)
.attach('file', Buffer.from('content'), mockFilename);

expect(response.body).toEqual({
message: 'File uploaded successfully',
file: { url: `${mockDestination}/${mockFilename}` },
});
});

it('/files/upload-file (POST); for empty file check', async () => {
const mockDestination = 'uploads';
const mockFilename = 'empty.txt';

const response = await request(app.getHttpServer())
.post(
`/files/upload-file?destination=${mockDestination}&filename=${mockFilename}`,
)
.attach('file', Buffer.from(''), mockFilename);

expect(response.body).toEqual({
statusCode: 400,
message: 'empty file uploads are not allowed',
});
});
});

0 comments on commit dc54f0b

Please sign in to comment.