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


TypeScript should.default方法代碼示例

本文整理匯總了TypeScript中should.default方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript should.default方法的具體用法?TypeScript should.default怎麽用?TypeScript should.default使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在should的用法示例。


在下文中一共展示了should.default方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

    it("example from 162 - way 1 : using setValueFromSource", () => {

        const myCustomObjectType = findOrCreateCustomObjectType(addressSpace);

        const myObject = myCustomObjectType.instantiate({
            browseName: "MyObject",
            organizedBy: "RootFolder",
        })  as MyCustomObject;

        should(myObject).hasOwnProperty("customProperty");
        // the first method consist of accessing the customProperty and
        // setting the value when ever it change from the outside.
        myObject.customProperty.setValueFromSource({ dataType: DataType.Double, value: -32 });

        // verification
        // xx console.log(myObject.customProperty.readValue().toString());
        myObject.customProperty.readValue().value.value.should.eql(-32);

    });
開發者ID:node-opcua,項目名稱:node-opcua,代碼行數:19,代碼來源:test_issue_162.ts

示例2: should

                            .then(resultState => {


                                should(resultState.selectedSailId).be.exactly(newSailNid);

                                should(resultState.selectedCabin.sailId).be.exactly(newSailNid);


                                should(resultState.cabinGridSelect.inside.sailId).be.exactly(newSailNid);
                                should(resultState.cabinGridSelect.outside.sailId).be.exactly(newSailNid);
                                should(resultState.cabinGridSelect.balcony.sailId).be.exactly(newSailNid);
                                should(resultState.cabinGridSelect.suite.sailId).be.exactly(newSailNid);

                                resultState.cabintypeSelect.forEach(item => {
                                    should(item.sailId).be.exactly(newSailNid);
                                });

                                should(resultState.sailSelect.some(e => e.id === newSailNid)).be.ok();

                            });
開發者ID:GauSim,項目名稱:angular1-rx-text,代碼行數:20,代碼來源:StoreDispatchers.Sepc.ts

示例3: should

 }, (res) => {
     should(res.headers['location']).be.eql('/main')
     done();
     server.close();
 })
開發者ID:lleobox,項目名稱:flask-node,代碼行數:5,代碼來源:response.test.ts

示例4: assertBlock

 .then(v => assertBlock(done, () => {
     should(v).deepEqual(validHash);
 }))
開發者ID:rd-dev-ukraine,項目名稱:pojo-fluent-validator,代碼行數:3,代碼來源:hash-validator-test.ts

示例5: it

 it("Should construct a recipe", () => {
     should(fermentable.name).equal('Pale Malt', "Should be able to set paramaters");
 });
開發者ID:anthonyvscode,項目名稱:brauhaus-ts,代碼行數:3,代碼來源:recipeTest.ts

示例6: assertBlock

 .catch(err => assertBlock(done, () => {
     should(err).deepEqual({
         "": ["> 50", "> 100"],
         "id": ["> 0"]
     })
 }));
開發者ID:Igor-Maf,項目名稱:lore,代碼行數:6,代碼來源:rule-sequence-test.ts

示例7: before

 before(() => {
     addressSpace = maintest.addressSpace;
     should(addressSpace).be.instanceof(AddressSpace);
 });
開發者ID:node-opcua,項目名稱:node-opcua,代碼行數:4,代碼來源:subtest_two_state_discrete_type.ts

示例8: constructObjectType

    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

示例9: should

 .then(result => should(result).be.exactly(false))
開發者ID:dev-hartmann,項目名稱:rule-engine,代碼行數:1,代碼來源:ConditionSpec.ts


注:本文中的should.default方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。