Skip to content

Commit

Permalink
tests for higher coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
fahad19 committed Apr 24, 2017
1 parent fe916d5 commit e2befc3
Showing 1 changed file with 40 additions and 37 deletions.
77 changes: 40 additions & 37 deletions test/externalsTest.js
Expand Up @@ -15,50 +15,53 @@ describe("externals", function() {
};
});

testLocal(
// name
"composes class from external module",
[
{
name: "composes class from external module, with query string",
query: '?localIdentName=_[local]&externals={"external":"External"}',
},
{
name: "composes class from external module, with externals as an array",
query: '?{"localIdentName":"_[local]","externals":[{"external":"External"}]}',
}
].forEach(function (t) {
testLocal(
// name
t.name,

// input
[
":local(.c1) { composes: c2 from \"external\"; b: 1; }",
":local(.c3) { composes: c1; b: 3; }",
":local(.c5) { composes: c2 c4 from \"external\"; b: 5; }"
].join("\n"),
// input
[
":local(.c1) { composes: c2 from \"external\"; b: 1; }",
":local(.c3) { composes: c1; b: 3; }",
":local(.c5) { composes: c2 c4 from \"external\"; b: 5; }"
].join("\n"),

// result
[
// result
[
1,
[
"._c1 { b: 1; }",
"._c3 { b: 3; }",
"._c5 { b: 5; }"
].join("\n"), ""
]
],
1,
[
"._c1 { b: 1; }",
"._c3 { b: 3; }",
"._c5 { b: 5; }"
].join("\n"), ""
]
],

// localsResult
{
c1: "_c1 imported-c2",
c3: "_c3 _c1 imported-c2",
c5: "_c5 imported-c2 imported-c4"
},
// localsResult
{
c1: "_c1 imported-c2",
c3: "_c3 _c1 imported-c2",
c5: "_c5 imported-c2 imported-c4"
},

// query
'?localIdentName=_[local]&externals={"external":"External"}',
// query
t.query,

// @TODO: test with query as an object too
// {
// localIdentName: '_[local]',
// externals: {
// external: 'External'
// }
// },

// modules
{}
);
// modules
{}
);
});

after(function () {
delete global.External;
Expand Down

0 comments on commit e2befc3

Please sign in to comment.