当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript should.exist函数代码示例

本文整理汇总了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);
 });
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:5,代码来源:transport_test.ts

示例2: describe

 describe('Update', function() {
   should.exist(true); // no-op
   // access tokens have no update API, they can only be created or removed
 });
开发者ID:BitGo,项目名称:BitGoJS,代码行数:4,代码来源:accesstoken.ts

示例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);

            });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:80,代码来源:utest_condition.ts


注:本文中的should.exist函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。