mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Refactoring of NodeUtils and NodeGuards classes
This commit is contained in:
@@ -22,7 +22,7 @@ describe('NodeGuards', () => {
|
||||
|
||||
before(() => {
|
||||
NodeUtils.parentize(parentNode);
|
||||
result = NodeGuards.isNodeHasBlockScope(node);
|
||||
result = NodeGuards.isNodeHasBlockScope(node, parentNode);
|
||||
});
|
||||
|
||||
it('should check if node has block scope', () => {
|
||||
@@ -42,7 +42,7 @@ describe('NodeGuards', () => {
|
||||
|
||||
before(() => {
|
||||
NodeUtils.parentize(parentNode);
|
||||
result = NodeGuards.isNodeHasBlockScope(node);
|
||||
result = NodeGuards.isNodeHasBlockScope(node, parentNode);
|
||||
});
|
||||
|
||||
it('should check if node has block scope', () => {
|
||||
@@ -80,7 +80,7 @@ describe('NodeGuards', () => {
|
||||
|
||||
before(() => {
|
||||
NodeUtils.parentize(parentNode);
|
||||
result = NodeGuards.isNodeHasBlockScope(node);
|
||||
result = NodeGuards.isNodeHasBlockScope(node, parentNode);
|
||||
});
|
||||
|
||||
it('should check if node has block scope', () => {
|
||||
@@ -108,7 +108,7 @@ describe('NodeGuards', () => {
|
||||
|
||||
before(() => {
|
||||
NodeUtils.parentize(parentNode);
|
||||
result = NodeGuards.isNodeHasBlockScope(node);
|
||||
result = NodeGuards.isNodeHasBlockScope(node, parentNode);
|
||||
});
|
||||
|
||||
it('should check if node has block scope', () => {
|
||||
@@ -128,7 +128,7 @@ describe('NodeGuards', () => {
|
||||
|
||||
before(() => {
|
||||
NodeUtils.parentize(parentNode);
|
||||
result = NodeGuards.isNodeHasBlockScope(node);
|
||||
result = NodeGuards.isNodeHasBlockScope(node, parentNode);
|
||||
});
|
||||
|
||||
it('should check if node has block scope', () => {
|
||||
@@ -136,22 +136,6 @@ describe('NodeGuards', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('exception checks', () => {
|
||||
describe('no `parentNode` property', () => {
|
||||
const node: ESTree.Node = Nodes.getBlockStatementNode();
|
||||
|
||||
let testFunc: Function;
|
||||
|
||||
before(() => {
|
||||
testFunc = () => NodeGuards.isNodeHasBlockScope(node);
|
||||
});
|
||||
|
||||
it('should check if node has block scope', () => {
|
||||
assert.throw(testFunc, Error);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNodeHasScope (node: ESTree.Node): node is TNodeWithScope', () => {
|
||||
|
||||
Reference in New Issue
Block a user