本文整理匯總了TypeScript中should.exist函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript exist函數的具體用法?TypeScript exist怎麽用?TypeScript exist使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了exist函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should result in a server transport provider', () => {
const logger = new Logger(provider.config.logger);
server = new Server(provider.config.server, logger);
should.exist(server);
});
示例2: describe
describe('Update', function() {
should.exist(true); // no-op
// access tokens have no update API, they can only be created or removed
});
示例3: it
it("should raise a new condition ", () => {
const namespace = addressSpace.getOwnNamespace();
const condition = namespace.instantiateCondition(myCustomConditionType, {
browseName: "MyCustomCondition3",
conditionSource: source,
optionals: [
"EnabledState.EffectiveDisplayName",
"EnabledState.TransitionTime"
],
organizedBy: addressSpace.rootFolder.objects
});
// install the event catcher
const serverObject = addressSpace.rootFolder.objects.server;
const spy_on_event = sinon.spy();
serverObject.on("event", spy_on_event);
// raise the event
condition.raiseNewCondition({
message: "Hello Message",
quality: StatusCodes.Good,
severity: 1235
});
spy_on_event.callCount.should.eql(1);
const evtData = spy_on_event.getCall(0).args[0];
// xx console.log("evtData = ", evtData.constructor.name);
// xx console.log("evtData = ", evtData);
// Xx console.log(" EVENT RECEIVED :", evtData.sourceName.readValue().value.toString());
// Xx console.log(" EVENT ID :", evtData.eventId.readValue().value.toString("hex"));
should.exist(evtData.eventId.value, "Event must have a unique eventId");
evtData.severity.value.should.eql(1235); // ,"the severity should match expecting severity");
evtData.quality.value.should.eql(StatusCodes.Good);
// the sourceName of the event should match the ConditionSourceNode
// xx todo evtData.getSourceName().text.should.eql(source.browseName.toString());
evtData.eventType.value.should.eql(myCustomConditionType.nodeId);
evtData.message.value.text.should.eql("Hello Message");
evtData.sourceNode.value.should.eql(source.nodeId);
// raise an other event
condition.raiseNewCondition({
message: "Something nasty happened",
quality: StatusCodes.Bad,
severity: 1000
});
spy_on_event.callCount.should.eql(2);
const evtData1 = spy_on_event.getCall(1).args[0];
// xx console.log(" EVENT RECEIVED :", evtData1.sourceName.readValue().value.value);
// xx console.log(" EVENT ID :", evtData1.eventId.readValue().value.value.toString("hex"));
should(evtData1.eventId.value).not.eql(evtData.eventId.value, "EventId must be different from previous one");
evtData1.severity.value.should.eql(1000, "the severity should match expecting severity");
evtData1.quality.value.should.eql(StatusCodes.Bad);
// raise with only severity
condition.raiseNewCondition({
severity: 1001
});
spy_on_event.callCount.should.eql(3);
const evtData2 = spy_on_event.getCall(2).args[0];
// xx console.log(" EVENT RECEIVED :", evtData2.sourceName.readValue().value.value);
// xx console.log(" EVENT ID :", evtData2.eventId.readValue().value.value.toString("hex"));
should(evtData2.eventId.value).not.eql(evtData.eventId.value, "EventId must be different from previous one");
evtData2.severity.value.should.eql(1001, "the severity should match expecting severity");
evtData2.quality.value.should.eql(StatusCodes.Bad);
});