本文整理汇总了TypeScript中basic/testing.it函数的典型用法代码示例。如果您正苦于以下问题:TypeScript it函数的具体用法?TypeScript it怎么用?TypeScript it使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了it函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe('compiling', function () {
it('works s', function () {
compiling('(10, void 0)').standardly()
.overTo(expecting).beOk()
.overTo(querying).files().without('lib.d.ts').first().dare('Unable to get a source file.')
.nodes().at(1).dare('').overTo(tracing).log('Node');
});
});
示例2: describe
describe('reading clusions', function () {
it('succeeds with a valid regexp pattern as string', function () {
const actual = readClusion('\\.d\\.ts');
expect(actual.length).toBe(1);
expect(bt.beLuck(actual[0]!).luck.source).toBe('\\.d\\.ts');
});
it('fails with an invalid regexp pattern as string', function () {
const actual = readClusion('(');
expect(actual.length).toBe(1);
expect(bt.beFuck(actual[0]!).fuck).toBe('Value cannot be parsed as a regexp.');
});
it('succeeds with an array of valid regexp patterns as strings', function () {
const actual = readClusion(['a', 'b']);
expect(actual.length).toBe(2);
expect(bt.beLuck(actual[0]!).luck.source).toBe('a');
expect(bt.beLuck(actual[1]!).luck.source).toBe('b');
});
});
示例3: it
import { betterBeIssues } from "linting/asserting";
import { it } from "basic/testing";
import { building } from "linting/building";
import rule from 'rules/no-constant-lambdas/rule';
it('no lambdas returning number literal', function () {
betterBeIssues(`
function run<T>(toValue: () => T): T { return toValue(); };
run(() => 1);
`,
building().stateless(rule).node().file().rule, {}, {},
[{topic: 'no-literal-lambdas', message: 'literal returned'}]
);
});
it('no lambdas returning string literal', function () {
betterBeIssues(`
function run<T>(toValue: () => T): T { return toValue(); };
run(() => '');
`,
building().stateless(rule).node().file().rule, {}, {},
[{topic: 'no-literal-lambdas', message: 'literal returned'}]
);
});
it('no lambdas returning null', function () {
betterBeIssues(`
function run<T>(toValue: () => T): T { return toValue(); };
run(() => null);
`,
building().stateless(rule).node().file().rule, {}, {},
示例4: describe
describe('a loose parser', function () {
it('reads empty input', function () {
const parsed = readLoosely('', noCommands);
expecting(parsed).haveNoArgs().haveNoCommands();
});
// commands
it('reads a sole command', function () {
const parsed = readLoosely('run', oneCommand);
expecting(parsed).haveCommands(['run']).haveNoArgs();
});
it('fails at a command if no commands are intended', function () {
const parsed = readLoosely('run', noCommands);
expecting(parsed).beFailedDueTo(unexpectedCommand);
});
// sole short param
it('reads a sole short flag parameter', function () {
const parsed = readLoosely('-f', noCommands);
expecting(parsed).haveShortArgs({ 'f': undefined }).haveNoFullArgs().haveNoCommands();
});
it('reads a sole short parameter with a value', function () {
const parsed = readLoosely('-p test', noCommands);
expecting(parsed).haveShortArgs({ 'p': 'test' }).haveNoFullArgs().haveNoCommands();
});
it('reads a short sole parameter with a double-quoted value', function () {
const parsed = readLoosely('-p "many words"', noCommands);
expecting(parsed).haveShortArgs({ 'p': 'many words' }).haveNoFullArgs().haveNoCommands();
});
it('reads a short sole parameter with a double-quoted value with a double-quote in it', function () {
const parsed = readLoosely('-p """try ""value"""', noCommands);
expecting(parsed).haveShortArgs({ 'p': '"try "value"' }).haveNoFullArgs().haveNoCommands();
});
// full sole param
it('reads a sole full flag parameter', function () {
const parsed = readLoosely('--flag', noCommands);
expecting(parsed).haveFullArgs({ 'flag': undefined }).haveNoShortArgs().haveNoCommands();
});
it('reads a sole full parameter with a value', function () {
const parsed = readLoosely('--param test', noCommands);
expecting(parsed).haveFullArgs({ 'param': 'test' }).haveNoShortArgs().haveNoCommands();
});
it('reads a sole full parameter with a double-quoted value', function () {
const parsed = readLoosely('--param "value"', noCommands);
expecting(parsed).haveFullArgs({ 'param': 'value' }).haveNoShortArgs().haveNoCommands();
});
it('reads a sole full parameter with a double-quoted value with a double-quote in it', function () {
const parsed = readLoosely('--param """try ""value"""', noCommands);
expecting(parsed).haveFullArgs({ 'param': '"try "value"' }).haveNoShortArgs().haveNoCommands();
});
// full multiple params
it('reads multiple full flag parameter', function () {
const parsed = readLoosely('--flag --toggler --switch', noCommands);
expecting(parsed).haveFullArgs({ 'flag': undefined, 'toggler': undefined, 'switch': undefined }).haveNoShortArgs().haveNoCommands();
});
// multiples
it('reads a short flag parameter amid others', function () {
const parsed = readLoosely('-f -t -s', noCommands);
expecting(parsed).haveShortArgs({ 'f': undefined, 't': undefined, 's': undefined }).haveNoFullArgs().haveNoCommands();
});
it('fails at the same short parameter', function () {
const parsed = readLoosely('-p once -p again', noCommands);
expecting(parsed).beFailedDueTo(unexpectedParameterName);
});
});