本文整理汇总了TypeScript中chai.assert.isDefined方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.isDefined方法的具体用法?TypeScript assert.isDefined怎么用?TypeScript assert.isDefined使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chai.assert
的用法示例。
在下文中一共展示了assert.isDefined方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('Produces new session when query changes', async () => {
assert.isUndefined(routingStore._session);
routingStore.urlLengthThresholdForSession = 4;
routingStore.updateRoute({
param1: undefined,
param2: 'altered',
param3: 'new'
});
assert.isDefined(routingStore._session);
assert.isDefined(routingStore.location.query.session_id);
await sleep(0);
assert.equal(routingStore.location.query.session_id, 'somekey','we have non-pending session_id');
saveRemoteSessionStub.returns(Promise.resolve({id:'monkeys'}));
// now change route again
routingStore.updateRoute({
param1: undefined,
param2: 'blah',
param3: 'another'
});
assert.equal(routingStore.location.query.session_id, 'pending', 'goes to pending');
await sleep(0);
assert.equal(routingStore.location.query.session_id, 'monkeys','we have a new session id');
});
示例2: test
test('resolves the Polymer.Base class', async () => {
// This directory contains files copied from Polymer 1.x core.
const analyzer = Analyzer.createForDirectory(
path.resolve(fixtureDir, 'polymer-core-feature/'));
const analysis = await analyzer.analyzePackage();
const features = analysis.getFeatures({id: 'Polymer.Base', kind: 'class'});
assert.equal(features.size, 1);
const polymerBase = features.values().next().value;
assert.equal(polymerBase.methods.size, 35);
assert.equal(polymerBase.properties.size, 2);
// A method from debounce.html
const debounce = polymerBase.methods.get('debounce');
assert.isDefined(debounce);
assert.equal(debounce!.privacy, 'public');
assert.equal(debounce!.params![0].name, 'jobName');
// A method from base.html
const addFeature = polymerBase.methods.get('_addFeature');
assert.isDefined(addFeature);
assert.equal(addFeature!.privacy, 'protected');
// A property from behaviors.html
const behaviors = polymerBase.properties.get('behaviors');
assert.isDefined(behaviors);
});
示例3: it
it("should correctly dispatch receiveMetrics", function() {
let response = new protos.cockroach.ts.TimeSeriesQueryResponse({
results: [
{
datapoints: [],
},
],
});
let request = new protos.cockroach.ts.TimeSeriesQueryRequest({
start_nanos: Long.fromInt(0),
end_nanos: Long.fromInt(10),
queries: [
{
name: "test.metric.1",
},
],
});
state = reducer(state, metrics.receiveMetrics(componentID, request, response));
assert.isDefined(state.queries);
assert.isDefined(state.queries[componentID]);
assert.lengthOf(_.keys(state.queries), 1);
assert.equal(state.queries[componentID].data, response);
assert.equal(state.queries[componentID].request, request);
assert.isUndefined(state.queries[componentID].nextRequest);
assert.isUndefined(state.queries[componentID].error);
});
示例4: it
it('basic', function () {
assert.isDefined(Store);
assert.isFunction(Store);
var instance = new Store();
assert.isDefined(instance);
assert.isObject(instance);
assert.isDefined(instance._type);
assert.isString(instance._type);
assert.equal(instance._type, 'Relution.livedata.Store');
})
示例5: it
it('basic', function () {
assert.isDefined(Collection);
assert.isFunction(Collection);
var instance = new Collection();
assert.isDefined(instance);
assert.isObject(instance);
assert.isDefined(instance._type);
assert.isString(instance._type);
assert.equal(instance._type, 'Relution.livedata.Collection');
}),
示例6: it
it("default", () => {
const resolver = new CommandLine({ options: { } });
assert.isUndefined(resolver.getDefaultGroup());
assert.isUndefined(resolver.getPassthruOption());
assert.isUndefined(resolver.getRestOption());
assert.isDefined(resolver.getHelpOption());
assert.deepEqual(resolver.groups, []);
assert.isDefined(resolver.fromShortName("?"));
assert.isDefined(resolver.fromShortName("h"));
assert.isDefined(resolver.fromLongName("help"));
});
示例7: it
it('basic', function () {
assert.isDefined(Model);
assert.isFunction(Model);
var instance = new Model();
assert.isDefined(instance);
assert.isObject(instance);
assert.isDefined(instance._type);
assert.isString(instance._type);
assert.equal(instance._type, 'Relution.livedata.Model');
}),
示例8: it
it("should find elements", async () => {
firstButton = await driver.findElementByAutomationText("Toggle first");
secondButton = await driver.findElementByAutomationText("Toggle second");
firstLabel = await driver.findElementByAutomationText("== 1 ==");
secondLabel = await driver.findElementByAutomationText("== 2 ==");
assert.isDefined(firstButton);
assert.isDefined(secondButton);
assert.isDefined(firstLabel);
assert.isDefined(secondLabel);
});