From de1d976af971743b5bdded0303371f7729ecbe25 Mon Sep 17 00:00:00 2001 From: Romain Faust <11320210+romain-faust@users.noreply.github.com> Date: Thu, 23 Aug 2018 19:25:56 +0200 Subject: [PATCH] Simplify tests --- types/imagemin/imagemin-tests.ts | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/types/imagemin/imagemin-tests.ts b/types/imagemin/imagemin-tests.ts index 45da266161..42fa6e6ba6 100644 --- a/types/imagemin/imagemin-tests.ts +++ b/types/imagemin/imagemin-tests.ts @@ -1,21 +1,9 @@ import imagemin = require('imagemin'); -const input = ['/input/**/*']; -const output = '/output/dir'; -const options = { plugins: [] }; -const handler = (result: imagemin.Result[]) => { - // ... -}; +imagemin(['*.png']).then((results: imagemin.Result[]) => { /* ... */ }); +imagemin(['*.png'], 'dist').then((results: imagemin.Result[]) => { /* ... */ }); +imagemin(['*.png'], { plugins: [] }).then((results: imagemin.Result[]) => { /* ... */ }); +imagemin(['*.png'], 'dist', { plugins: [] }).then((results: imagemin.Result[]) => { /* ... */ }); -imagemin(input).then(handler); -imagemin(input, output).then(handler); -imagemin(input, options).then(handler); -imagemin(input, output, options).then(handler); - -const buffer = Buffer.from([ /* File content */ ]); -const bufferHandler = (result: Buffer) => { - // ... -}; - -imagemin.buffer(buffer).then(bufferHandler); -imagemin.buffer(buffer, options).then(bufferHandler); +imagemin.buffer(Buffer.from[/* ... */]).then((result: Buffer) => { /* ... */ }); +imagemin.buffer(Buffer.from[/* ... */], { plugins: [] }).then((result: Buffer) => { /* ... */ });