Skip to content

Commit

Permalink
add new test
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiosantoscode committed Feb 23, 2023
1 parent fa6f164 commit 324c63d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/mocha/minify.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@ describe("minify", function() {
assert.deepEqual(Object.keys(nameCache.props.props), ["$a_prop"]);
});

it("Should be able to use a dotted property to reach nameCache", async function () {
const nameCache = {};

const options = {
nameCache,
toplevel: true,
mangle: {
properties: true
},
compress: false
};

await minify("const a_var = { a_prop: 'long' }", options);

assert.deepEqual(Object.keys(options.nameCache.vars.props), ["$a_var"]);
assert.deepEqual(Object.keys(options.nameCache.props.props), ["$a_prop"]);
});

it("Should accept new `format` options as well as `output` options", async function() {
const { code } = await minify("x(1,2);", { format: { beautify: true }});
assert.strictEqual(code, "x(1, 2);");
Expand Down

0 comments on commit 324c63d

Please sign in to comment.