Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
expose BaseNode#setDescription #1284
- Loading branch information
1 parent
b3ac8eb
commit 472f424
Showing
3 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { coerce } from "yargs"; | ||
import { AddressSpace } from ".."; | ||
import { generateAddressSpace } from "../distNodeJS"; | ||
import { get_mini_nodeset_filename } from "../testHelpers"; | ||
import "should"; | ||
import { coerceLocalizedText } from "node-opcua-data-model"; | ||
|
||
const mini_nodeset_filename = get_mini_nodeset_filename(); | ||
|
||
describe("setDescription", () => { | ||
let addressSpace: AddressSpace; | ||
|
||
beforeEach(async () => { | ||
addressSpace = AddressSpace.create(); | ||
const xml_files = [mini_nodeset_filename]; | ||
await generateAddressSpace(addressSpace, xml_files); | ||
|
||
addressSpace.registerNamespace("Private"); | ||
}); | ||
afterEach(() => { | ||
if (addressSpace) { | ||
addressSpace.dispose(); | ||
} | ||
}); | ||
it("should be possible to change the description of a variable", () => { | ||
const namespace = addressSpace.getOwnNamespace(); | ||
|
||
const uaVariable = namespace.addVariable({ | ||
browseName: "MyVariable", | ||
dataType: "Double", | ||
organizedBy: addressSpace.rootFolder.objects, | ||
description: {locale: "fr", text:"Ma Variable"} | ||
}); | ||
|
||
uaVariable.description.text!.should.eql("Ma Variable"); | ||
|
||
|
||
uaVariable.setDescription({ locale: "fi", text: "minun muuttujani" }); | ||
|
||
uaVariable.description.text!.should.eql("minun muuttujani"); | ||
|
||
}); | ||
}); |