Skip to content

Commit

Permalink
[Test] namespace: ensure valid case is actually included
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath authored and ljharb committed Sep 3, 2024
1 parent 8bdb32b commit a3015eb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/src/rules/namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,10 @@ const invalid = [].concat(
test({ parser, code: `import { b } from "./${folder}/a"; console.log(b.c.d.e)` }),
test({ parser, code: `import * as a from "./${folder}/a"; console.log(a.b.c.d.e.f)` }),
test({ parser, code: `import * as a from "./${folder}/a"; var {b:{c:{d:{e}}}} = a` }),
test({ parser, code: `import { b } from "./${folder}/a"; var {c:{d:{e}}} = b` }));

// deep namespaces should include explicitly exported defaults
test({ parser, code: `import * as a from "./${folder}/a"; console.log(a.b.default)` }),
test({ parser, code: `import { b } from "./${folder}/a"; var {c:{d:{e}}} = b` }),
// deep namespaces should include explicitly exported defaults
test({ parser, code: `import * as a from "./${folder}/a"; console.log(a.b.default)` }),
);

invalid.push(
test({
Expand Down Expand Up @@ -371,7 +371,8 @@ const invalid = [].concat(
parser,
code: `import * as a from "./${folder}/a"; var {b:{c:{ e }}} = a`,
errors: ["'e' not found in deeply imported namespace 'a.b.c'."],
}));
}),
);
});

ruleTester.run('namespace', rule, { valid, invalid });

0 comments on commit a3015eb

Please sign in to comment.