本文整理汇总了TypeScript中chai.assert.include方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.include方法的具体用法?TypeScript assert.include怎么用?TypeScript assert.include使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chai.assert
的用法示例。
在下文中一共展示了assert.include方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('compiles ES2017 to ES5', async () => {
const result =
jsTransform('async function test() { await 0; }', {compile: 'es5'});
assert.include(result, '_asyncToGenerator');
assert.notInclude(result, 'async function test');
assert.include(result, 'regeneratorRuntime');
});
示例2: test
test('adds prefetch links for transitive deps of unbundled', async () => {
const project = new PolymerProject({
root: 'test-fixtures/bundle-project/',
entrypoint: 'index.html',
});
const files = await emittedFiles(
mergeStream(project.sources(), project.dependencies())
.pipe(project.addPrefetchLinks()),
project.config.root);
const html = files.get('index.html').contents.toString();
// No prefetch links needed for direct dependency.
assert.notInclude(
html, '<link rel="prefetch" href="/simple-import.html">');
// Prefetch added for the transitive dependencies of `index.html`,
// which are all direct dependencies of `simple-import.html`.
assert.include(html, '<link rel="prefetch" href="/simple-script.js">');
assert.include(html, '<link rel="prefetch" href="/simple-style.css">');
assert.include(
html, '<link rel="prefetch" href="/simple-import-2.html">');
});
示例3: test
test('bundler deals with posix platform separators on win32', async () => {
const posixSepPaths = new FileTransform((stream, file) => {
if (path.sep === '\\') {
file.path = file.path.replace(/\\/g, '/');
}
stream.push(file);
});
await setupTest(
{
root: path.resolve('test-fixtures/bundle-project'),
entrypoint: 'index.html'
},
{},
posixSepPaths);
const bundledHtml = getFileOrDie('index.html');
// In setupTest, we use a transform stream that forces the file paths to
// be in the posix form (this only changes/matters for win32)
// and it verifies that bundler can process files that may be merged in
// or have otherwise have paths in posix separator form.
assert.include(bundledHtml, '<title>Sample Build</title>', 'index.html');
assert.include(
bundledHtml, '<dom-module id="my-element">', 'simple-import.html');
assert.include(
bundledHtml, '<dom-module id="my-element-2">', 'simple-import-2.html');
assert.include(bundledHtml, '.simply-red', 'simple-style.css');
});
示例4: readFile
.run(err => {
if (err) throw err;
let pkg = JSON.parse(readFile(this.cwd, 'my-app/package.json'));
assert.propertyVal(pkg, 'name', 'my-app');
assert.propertyVal(pkg, 'version', '0.1.0');
assert.propertyVal(pkg, 'description', 'My new app!');
assert.propertyVal(pkg, 'license', 'MIT');
assert.deepProperty(pkg, 'dependencies.neon-cli');
let cargo = TOML.parse(readFile(this.cwd, 'my-app/native/Cargo.toml'));
assert.deepPropertyVal(cargo, 'package.name', 'my-app');
assert.deepPropertyVal(cargo, 'package.version', '0.1.0');
assert.deepPropertyVal(cargo, 'package.license', 'MIT');
assert.deepPropertyVal(cargo, 'lib.name', 'my_app');
assert.deepProperty(cargo, 'dependencies.neon');
let indexjs = readFile(this.cwd, 'my-app/lib/index.js');
assert.include(indexjs, `require('../native')`);
let librs = readFile(this.cwd, 'my-app/native/src/lib.rs');
assert.include(librs, `extern crate neon;`);
done();
});
示例5: it
it("mentions the root cause if a config file extends from an invalid file", async () => {
const result = await execRunnerWithOutput({config: "test/config/tslint-extends-invalid.json", files: ["src/test.ts"]});
assert.equal(result.status, Status.FatalError, "process should exit with error");
assert.include(result.stderr, "Failed to load", "stderr should contain notification about failing to load json config");
assert.include(result.stderr, "tslint-invalid.json", "stderr should mention the problem file");
assert.strictEqual(result.stdout, "", "shouldn't contain any output in stdout");
});
示例6: test
test('displays command help when called with the --help flag', async () => {
const cli = new PolymerCli(['build', '--help']);
const output = await interceptOutput(async () => {
await cli.run();
});
assert.include(output, 'polymer build');
assert.include(output, 'Command Options');
assert.include(output, '--bundle');
});
示例7: it
it('should add a graphql error to the message', () => {
const graphQLErrors = [ new Error('this is an error message') ];
const apolloError = new ApolloError({
graphQLErrors,
});
assert.include(apolloError.message, 'GraphQL error: ');
assert.include(apolloError.message, 'this is an error message');
assert.equal(apolloError.message.split('\n').length, 1);
});
示例8: it
it('should return some proper html', function () {
const html = ServerRenderer.render(store.createDefault({log: false}));
assert.isString(html, "The rendered HTML needs to be a string");
assert.include(html, '<div', 'rendered HTML contains at least an open div');
assert.include(html, '</div>', 'rendered HTML contains at least an closed div');
// TODO: Make assumptions about the state in store.getState();
});