本文整理汇总了TypeScript中chai.assert.match方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.match方法的具体用法?TypeScript assert.match怎么用?TypeScript assert.match使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chai.assert
的用法示例。
在下文中一共展示了assert.match方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should replace object expression node `key` property with literal value by unicode value', () => {
let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
`var test = { 'foo': 0 };`,
Object.assign({}, NO_CUSTOM_NODES_PRESET)
);
assert.match(obfuscationResult.getObfuscatedCode(), /^var *test *= *\{'\\x66\\x6f\\x6f':0x0\};$/);
});
示例2: it
it('should replace member expression dot notation call by square brackets call with unicode literal value', () => {
let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
`var test = console.log;`,
Object.assign({}, NO_CUSTOM_NODES_PRESET)
);
assert.match(obfuscationResult.getObfuscatedCode(), /var *test *= *console\['\\x6c\\x6f\\x67'\];/);
});
示例3: it
it('should not obfuscate method definition node with `constructor` key', () => {
let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
code,
Object.assign({}, NO_CUSTOM_NODES_PRESET)
);
assert.match(obfuscationResult.getObfuscatedCode(), /constructor\(\)\{\}/);
});
示例4: it
it('stack frames', () => {
try {
dummy1();
assert.ok(false);
} catch (e) {
assert.match(e.stack, /dummy2[\s\S]*?dummy1/);
}
});
示例5: it
it('should obfuscate simple code with variable inside global scope', () => {
assert.match(
JavaScriptObfuscator.obfuscate(
`var test = 1;`,
Object.assign({}, NO_CUSTOM_NODES_PRESET)
).getObfuscatedCode(),
/^var *test *= *0x\d+;$/
);
});
示例6: function
helper.dataDrivenTest(tests, function(data, expect) {
try {
parse(data);
} catch (e) {
assert.match(e.message, expect);
return;
}
assert.fail(undefined, undefined, "No exception thrown.");
});
示例7: test
test('will log to a file when asked to', async() => {
const {client, baseDir} = await createTestEnvironment();
const logFile = join(baseDir, 'pes.log');
await client.changeConfiguration({logToFile: logFile});
await delay(100);
assert.match(
readFileSync(logFile, 'utf-8'),
/^\n\n\n\n\nInitialized with workspace path:/);
});
示例8: it
it('should add source map import to obfuscated code if source map mode is `separate`', () => {
expectedObfuscationResult = getCorrectedObfuscationResult(
obfuscatedCode,
sourceMap,
'output.js.map',
SourceMapMode.Separate
);
assert.match(expectedObfuscationResult.getObfuscatedCode(), /sourceMappingURL=output\.js\.map/);
});