Skip to content

Commit

Permalink
Merge pull request #357 from danielpeintner/revert-pr-328
Browse files Browse the repository at this point in the history
fix: revert pr #328 for v0.7.x
  • Loading branch information
danielpeintner authored Nov 11, 2020
2 parents aa1cf8c + 763188b commit 6854ab7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 6 additions & 4 deletions packages/core/src/exposed-thing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,10 @@ export default class ExposedThing extends TD.Thing implements WoT.ExposedThing {
readProperty(propertyName: string, options?: WoT.InteractionOptions): Promise<any> {
return new Promise<any>((resolve, reject) => {
if (this.properties[propertyName]) {
if(this.properties[propertyName].writeOnly && this.properties[propertyName].writeOnly === true) {
// writeOnly check skipped so far, see https://github.com/eclipse/thingweb.node-wot/issues/333#issuecomment-724583234
/* if(this.properties[propertyName].writeOnly && this.properties[propertyName].writeOnly === true) {
reject(new Error(`ExposedThing '${this.title}', property '${propertyName}' is writeOnly`));
}
} */

let ps: PropertyState = this.properties[propertyName].getState();
// call read handler (if any)
Expand Down Expand Up @@ -227,9 +228,10 @@ export default class ExposedThing extends TD.Thing implements WoT.ExposedThing {
writeProperty(propertyName: string, value: any, options?: WoT.InteractionOptions): Promise<void> {
return new Promise<void>((resolve, reject) => {
if (this.properties[propertyName]) {
if (this.properties[propertyName].readOnly && this.properties[propertyName].readOnly === true) {
// readOnly check skipped so far, see https://github.com/eclipse/thingweb.node-wot/issues/333#issuecomment-724583234
/* if (this.properties[propertyName].readOnly && this.properties[propertyName].readOnly === true) {
reject(new Error(`ExposedThing '${this.title}', property '${propertyName}' is readOnly`));
}
} */

let ps: PropertyState = this.properties[propertyName].getState();

Expand Down
6 changes: 4 additions & 2 deletions packages/core/test/ServerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ class WoTServerTest {
}
}

@test async "should not be able to read property with writeOnly"() {
// skipped so far, see https://github.com/eclipse/thingweb.node-wot/issues/333#issuecomment-724583234
@test.skip async "should not be able to read property with writeOnly"() {
let thing = await WoTServerTest.WoT.produce({
title: "ThingWithWriteOnly",
properties: {
Expand All @@ -169,7 +170,8 @@ class WoTServerTest {
}
}

@test async "should not be able to write property with readOnly"() {
// skipped so far, see https://github.com/eclipse/thingweb.node-wot/issues/333#issuecomment-724583234
@test.skip async "should not be able to write property with readOnly"() {
let thing = await WoTServerTest.WoT.produce({
title: "ThingWithReadOnly",
properties: {
Expand Down

0 comments on commit 6854ab7

Please sign in to comment.