本文整理匯總了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);
});
示例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();
});
示例3: should
}, (res) => {
should(res.headers['location']).be.eql('/main')
done();
server.close();
})
示例4: assertBlock
.then(v => assertBlock(done, () => {
should(v).deepEqual(validHash);
}))
示例5: it
it("Should construct a recipe", () => {
should(fermentable.name).equal('Pale Malt', "Should be able to set paramaters");
});
示例6: assertBlock
.catch(err => assertBlock(done, () => {
should(err).deepEqual({
"": ["> 50", "> 100"],
"id": ["> 0"]
})
}));
示例7: before
before(() => {
addressSpace = maintest.addressSpace;
should(addressSpace).be.instanceof(AddressSpace);
});
示例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");
//.........這裏部分代碼省略.........
示例9: should
.then(result => should(result).be.exactly(false))