當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript should類代碼示例

本文整理匯總了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;未經允許,請勿轉載。