Skip to content

Commit

Permalink
tests: replace uglify with terser in ast-utils tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abenezerabebe authored and sendilkumarn committed Mar 16, 2019
1 parent 2b8651b commit 73f493f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/utils/__tests__/ast-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,28 @@ describe("utils", () => {
describe("findPluginsByName", () => {
it("should find plugins in AST", () => {
const ast = j(`
{ foo: new webpack.optimize.UglifyJsPlugin() }
{ foo: new webpack.optimize.TerserPlugin() }
`);
const res = utils.findPluginsByName(j, ast, ["webpack.optimize.UglifyJsPlugin"]);
const res = utils.findPluginsByName(j, ast, ["webpack.optimize.TerserPlugin"]);
expect(res.size()).toEqual(1);
});

it("should find all plugins in AST", () => {
const ast = j(`
[
new UglifyJsPlugin(),
new TerserPlugin(),
new TestPlugin()
]
`);
const res = utils.findPluginsByName(j, ast, ["UglifyJsPlugin", "TestPlugin"]);
const res = utils.findPluginsByName(j, ast, ["TerserPlugin", "TestPlugin"]);
expect(res.size()).toEqual(2);
});

it("should not find false positives", () => {
const ast = j(`
{ foo: new UglifyJsPlugin() }
{ foo: new TerserPlugin() }
`);
const res = utils.findPluginsByName(j, ast, ["webpack.optimize.UglifyJsPlugin"]);
const res = utils.findPluginsByName(j, ast, ["webpack.optimize.TerserPlugin"]);
expect(res.size()).toEqual(0);
});
});
Expand Down

0 comments on commit 73f493f

Please sign in to comment.