• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript should类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中should的典型用法代码示例。如果您正苦于以下问题:TypeScript should类的具体用法?TypeScript should怎么用?TypeScript should使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了should类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: it

 it('should set correct API path based on passed configuration (version="asp")', function() {
     const api = new NodeApi({url: 'http://localhost', version: 'asp'})
     should(api._httpOptions.path).equal('/attask/api-asp')
 })
开发者ID:Workfront,项目名称:workfront-api,代码行数:4,代码来源:Api.spec.ts


示例2: before

 before(() => {
     addressSpace = maintest.addressSpace;
     should(addressSpace).be.instanceof(AddressSpace);
 });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:4,代码来源:subtest_two_state_discrete_type.ts


示例3: assertBlock

 .catch(err => assertBlock(done, () => {
     should(err).deepEqual({
         "": ["> 50", "> 100"]
     })
 }));
开发者ID:Igor-Maf,项目名称:lore,代码行数:5,代码来源:rule-sequence-test.ts


示例4: assertBlock

 .then(v => assertBlock(done, () => {
     should(v).be.null();
 }))
开发者ID:Igor-Maf,项目名称:lore,代码行数:3,代码来源:array-validator-test.ts


示例5: it

    it("should be possible to choose which optional item to instantiate in sub objects", () => {
        const namespace = addressSpace.getOwnNamespace();

        function constructObjectType() {

            const mySubObjectType1 = namespace.addObjectType({
                browseName: "MySubObjectType1"
            }) as MySubObjectType1;
            const prop1 = namespace.addVariable({
                browseName: "Property1",
                dataType: "Double",
                modellingRule: "Mandatory",
                propertyOf: mySubObjectType1,
            });

            mySubObjectType1.property1.browseName.toString().should.eql("1:Property1");

            const prop2 = namespace.addVariable({
                browseName: "Property2",
                dataType: "Double",
                modellingRule: "Optional",
                propertyOf: mySubObjectType1,
            });
            const prop3 = namespace.addVariable({
                browseName: "Property3",
                dataType: "Double",
                modellingRule: "Optional",
                propertyOf: mySubObjectType1,
            });

            const myObjectType2 = namespace.addObjectType({
                browseName: "MyObjectType1"
            }) as MyObjectType1;

            const subObj = mySubObjectType1.instantiate({
                browseName: "SubObj",
                componentOf: myObjectType2,
                modellingRule: "Optional",
                optionals: ["Property2", "Property3"]
            }) as MySubObject1;

            myObjectType2.getComponentByName("SubObj")!.browseName.toString().should.eql("1:SubObj");
            myObjectType2.subObj.getPropertyByName("Property1")!.browseName.toString().should.eql("1:Property1");
            myObjectType2.subObj.getPropertyByName("Property2")!.browseName.toString().should.eql("1:Property2");
            myObjectType2.subObj.getPropertyByName("Property3")!.browseName.toString().should.eql("1:Property3");

        }

        constructObjectType();

        const myObjectType1 = addressSpace.findObjectType("1:MyObjectType1")!;

        // -----------------------------------------------
        const obj1 = myObjectType1.instantiate({
            browseName: "Obj1",
            organizedBy: addressSpace.rootFolder.objects,
        }) as MyObject1;
        should(obj1.getComponentByName("SubObj")).eql(null);

        // -----------------------------------------------
        const obj2 = myObjectType1.instantiate({
            browseName: "Obj2",
            optionals: ["SubObj"],
            organizedBy: addressSpace.rootFolder.objects,
        }) as MyObject1;

        should.exist(obj2.getComponentByName("SubObj"));
        obj2.getComponentByName("SubObj")!.browseName.toString().should.eql("1:SubObj");

        should.exist(obj2.subObj.getPropertyByName("Property1"));
        should.not.exist(obj2.subObj.getPropertyByName("Property2"));
        should.not.exist(obj2.subObj.getPropertyByName("Property3"));

        // -----------------------------------------------
        const obj3 = myObjectType1.instantiate({
            browseName: "Obj3",
            optionals: [
                "SubObj.Property2",
                "SubObj.Property3"
            ],
            organizedBy: addressSpace.rootFolder.objects,

        }) as MyObject1;
        obj3.getComponentByName("SubObj")!.browseName.toString().should.eql("1:SubObj");

        should.exist(obj3.subObj.getPropertyByName("Property1"));
        should.exist(obj3.subObj.getPropertyByName("Property2"));
        should.exist(obj3.subObj.getPropertyByName("Property3"));

        // -----------------------------------------------
        const obj4 = myObjectType1.instantiate({
            browseName: "Obj4",
            optionals: [
                "SubObj.Property3"
            ],
            organizedBy: addressSpace.rootFolder.objects,
        }) as MyObject1;

        obj4.getComponentByName("SubObj")!.browseName.toString().should.eql("1:SubObj");

//.........这里部分代码省略.........
开发者ID:node-opcua,项目名称:node-opcua,代码行数:101,代码来源:test_address_space_object_instantiation.ts


示例6: it

 it('should return null when a zero-length array is given', () => {
   should(mergeIntervals([])).be.null();
 });
开发者ID:abe732,项目名称:react-layered-chart,代码行数:3,代码来源:intervalUtils-test.ts


示例7: before

 before(() => {
     addressSpace = maintest.addressSpace;
     namespace = addressSpace.getOwnNamespace();
     should(addressSpace).be.instanceof(AddressSpace);
 });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:5,代码来源:subtest_analog_item_type.ts


示例8: should

 }).on('end', () => {
     should(data.toString()).be.eql('<h1>hello lleohao</h1>')
     done();
     server.close();
 })
开发者ID:lleobox,项目名称:flask-node,代码行数:5,代码来源:response.test.ts


示例9: it

    it('return string template', () => {
        const template = '<h1>hello world</h1>';

        should(render(template)).be.eql(template);
    })
开发者ID:lleobox,项目名称:flask-node,代码行数:5,代码来源:render.test.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript slash类代码示例发布时间:2022-05-28
下一篇:
TypeScript sharp类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap