Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8 communication tests #39

Merged
merged 14 commits into from
Sep 20, 2024
Prev Previous commit
Next Next commit
refactor mqtt calculator tests
Signed-off-by: Hasan Eroglu <hasanheroglu@gmail.com>
hasanheroglu committed Sep 10, 2024
commit bfffcb8e05da8f3844ef624326a7acd7cda2ce84
10 changes: 1 addition & 9 deletions things/calculator/mqtt/js/test/client.test.js
Original file line number Diff line number Diff line change
@@ -22,21 +22,13 @@ const readProperty = async (thing, propertyName) => {
}
}

const writeProperty = async (thing, propertyName, propertyValue) => {
try {
await thing.writeProperty(propertyName, propertyValue)
} catch (error) {
console.error(`Error: ${error}`)
}
}

/**
* FIXME: To be able to test readProperty, issues https://github.com/eclipse-thingweb/node-wot/issues/980
* and https://github.com/eclipse-thingweb/node-wot/issues/1241 must be resolved.
* Until then we can use subscriptions.
*/

describe("Client Tests", () => {
describe.skip("Client Tests", () => {
before(async () => {
try {
const WoT = await servient.start()
2 changes: 1 addition & 1 deletion things/calculator/mqtt/js/test/fixtures.js
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ const port = 1883

exports.mochaGlobalSetup = async function() {
try {
response = await getInitiateMain([path.join(__dirname, '..', 'main.js'), '-p', `${port}`])
response = await getInitiateMain('node', [path.join(__dirname, '..', 'main.js'), '-p', `${port}`])
thingProcess = response.process
}
catch(error) {
5 changes: 1 addition & 4 deletions things/calculator/mqtt/js/test/td.test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
const Ajv = require('ajv')
const chai = require('chai')
const mqtt = require('mqtt')
const path = require('path')
const { getTDValidate } = require("../../../../../util/dist/util")
const { port } = require('./fixtures')

const spawn = require('child_process').spawn

const expect = chai.expect
const hostname = 'test.mosquitto.org'
const port = 1883

describe('Calculator MQTT JS', () => {
let validate