-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #140 from ysugimoto/override-oprimizers-arguments
Implement override optmizers arguments
- Loading branch information
Showing
9 changed files
with
98 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
"use strict"; | ||
|
||
const Pngquant = require("../lib/optimizer/Pngquant"); | ||
const Jpegoptim = require("../lib/optimizer/JpegOptim"); | ||
const Mozjpeg = require("../lib/optimizer/Mozjpeg"); | ||
const Gifsicle = require("../lib/optimizer/Gifsicle"); | ||
const test = require("ava"); | ||
|
||
test("Pngquant accepts override arguments", async t => { | ||
const pngquant = new Pngquant(["--lorem", "--ipsum"]); | ||
|
||
t.is(pngquant.args[0], "--lorem"); | ||
t.is(pngquant.args[1], "--ipsum"); | ||
// Override, but stdout argument must be exists | ||
t.is(pngquant.args[2], "-"); | ||
}); | ||
|
||
test("Jpegoptim accepts override arguments", async t => { | ||
const jpegoptim = new Jpegoptim(90, ["--lorem", "--ipsum"]); | ||
|
||
// Override, but stdin argument must be exists | ||
t.is(jpegoptim.args[0], "--stdin"); | ||
t.is(jpegoptim.args[1], "-m"); | ||
t.is(jpegoptim.args[2], 90); | ||
t.is(jpegoptim.args[3], "--lorem"); | ||
t.is(jpegoptim.args[4], "--ipsum"); | ||
t.is(jpegoptim.args[5], "--stdout"); | ||
}); | ||
|
||
test("Mozjpeg accepts override arguments", async t => { | ||
const mozjpeg = new Mozjpeg(90, ["--lorem", "--ipsum"]); | ||
|
||
// Override, but stdin argument must be exists | ||
t.is(mozjpeg.args[0], "-quality"); | ||
t.is(mozjpeg.args[1], 90); | ||
t.is(mozjpeg.args[2], "--lorem"); | ||
t.is(mozjpeg.args[3], "--ipsum"); | ||
}); | ||
|
||
test("Gifsicle accepts override arguments", async t => { | ||
const gifsicle = new Gifsicle(["--lorem", "--ipsum"]); | ||
|
||
// Override, but stdin argument must be exists | ||
t.is(gifsicle.args[0], "--lorem"); | ||
t.is(gifsicle.args[1], "--ipsum"); | ||
}); |