Skip to content

Commit 3560c22

Browse files
async throw error testing
1 parent 87dc8a9 commit 3560c22

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/test/imageSpec.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import server from '../server';
22
import supertest from 'supertest';
33
import resizeImage from '../utilize/sharp';
4-
import { cache } from 'sharp';
5-
4+
import { getImageMetaData } from '../utilize/sharp';
65

76
const response = supertest ( server ) ;
87

@@ -80,18 +79,22 @@ describe('these tests are focused at the validate middleware a failure tests at
8079
});
8180

8281
describe('these tests are focused at the utilize/sharp file ', () => {
83-
const testImageNameFailer = 'fjod' ;
84-
const testImageNamePass = 'fjord.jpg' ;
82+
const testImageNameFailure = 'fjod' ;
8583
const testImageWidth = 1500 ;
8684
const testImageHeight = 1500 ;
87-
it ('1.1 The resizeImage function, not.toThrow ',async ()=>{
88-
expect( async () => {
89-
await resizeImage (testImageNamePass , testImageWidth , testImageHeight );
90-
}).not.toThrow();
85+
it ('1.1 The resizeImage function,Wrong image name .toBeRejected ',async ()=>{
86+
87+
await expectAsync( resizeImage (testImageNameFailure , testImageWidth , testImageHeight ) ).toBeRejected();
88+
89+
});
90+
it ('1.2 The getImageMetaData function,Wrong image name .toBeRejected ',async ()=>{
91+
92+
await expectAsync( getImageMetaData ( testImageNameFailure ) ).toBeRejected();
93+
9194
});
9295
});
9396

94-
describe('these tests are focused at the createImage middleware at /api/image?' , ()=>{
97+
describe('these tests are focused at the createImage middleware at the middleware/api.image.Middleware/createImage.ts ' , ()=>{
9598

9699
const queriesSchema = {
97100
AllCorrect : '?name=encenadaport&width=407&height=365',

0 commit comments

Comments
 (0)