Skip to content
Permalink
Browse files
add integration test for spread operator
  • Loading branch information
sokra committed Feb 24, 2018
1 parent 39438c7 commit b0949cb2d26193bc4d384852927f00e51db1a824
@@ -0,0 +1 @@
module.exports = "ok";
@@ -0,0 +1,11 @@
import X, { A, B } from "./module";
import * as M from "./module";

it("should support spread operator", function() {
var o1 = { ...X };
o1.should.be.eql({ A: "A", B: "B" });
var o2 = { ...({ X }) };
o2.should.be.eql({ X: { A: "A", B: "B" } });
var o3 = { ...M };
o3.should.be.eql({ default: { A: "A", B: "B" }, A: "A", B: "B" });
});
@@ -0,0 +1,6 @@
const A = "A";
const B = "B";

export default { A, B };

export { A, B };
@@ -0,0 +1,5 @@
var supportsSpread = require("../../../helpers/supportsSpread");

module.exports = function(config) {
return supportsSpread();
};
@@ -0,0 +1,9 @@
module.exports = function supportsSpread() {
try {
var x = { a: true }, y; // eslint-disable-line no-unused-vars
eval("y = { ...x }");
return y !== x && y.a;
} catch(e) {
return false;
}
};

0 comments on commit b0949cb

Please sign in to comment.