Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const path = require('path');
const {tests} = require('@iobroker/testing');
// Run tests
tests.integration(path.join(__dirname, '..'), {
defineAdditionalTests(getHarness) {
describe('Test sendTo()', () => {
it('Should work', () => {
return new Promise(resolve => {
// Create a fresh harness instance each test!
const harness = getHarness();
// Start the adapter and wait until it has started
harness.startAdapterAndWait().then(() => {
harness.sendTo('hm-rega.0', 'test', 'message', (resp) => {
console.dir(resp);
resolve();
});
'use strict';
const path = require('path');
const {tests} = require('@iobroker/testing');
// Run tests
tests.integration(path.join(__dirname, '..'), {
defineAdditionalTests(getHarness) {
describe('Test sendTo()', () => {
it('Should work', () => {
return new Promise(resolve => {
// Create a fresh harness instance each test!
const harness = getHarness();
// Start the adapter and wait until it has started
harness.startAdapterAndWait().then(() => {
harness.sendTo('hm-rpc.0', 'test', 'message', (resp) => {
console.dir(resp);
resolve();
});
});
});
const path = require('path');
const { tests } = require('@iobroker/testing');
// Run unit tests - See https://github.com/ioBroker/testing for a detailed explanation and further options
tests.unit(path.join(__dirname, '..'), { "allowedExitCodes": [11] });
const path = require("path");
const { tests } = require("@iobroker/testing");
// Run unit tests - See https://github.com/ioBroker/testing for a detailed explanation and further options
tests.unit(path.join(__dirname, ".."),{
defineMockBehavior(db, adapter) {
adapter.objects.getObjectView.returns({rows: []});
}
});
'use strict';
const path = require('path');
const {tests} = require('@iobroker/testing');
// Run tests
tests.unit(path.join(__dirname, '..'));
const path = require('path');
const { tests } = require('@iobroker/testing');
// Run unit tests - See https://github.com/ioBroker/testing for a detailed explanation and further options
tests.unit(path.join(__dirname, '..'), { "allowedExitCodes": [11] });
const path = require('path');
const { tests } = require('@iobroker/testing');
// Run unit tests - See https://github.com/ioBroker/testing for a detailed explanation and further options
tests.unit(path.join(__dirname, '..'), { startTimeout: 10000 });
const path = require('path');
const { tests } = require('@iobroker/testing');
const jscToolsMock = {
// No update checks in unit tests
getInstalledInfo() { return {}; },
};
const jscLEMock = {
// No https/letsencrypt in unit tests
createServer(app) { return require("http").createServer(app); }
};
// Run unit tests - See https://github.com/ioBroker/testing for a detailed explanation and further options
tests.unit(path.join(__dirname, '..'), {
additionalMockedModules: {
"{CONTROLLER_DIR}/lib/tools.js": jscToolsMock,
"{CONTROLLER_DIR}/lib/tools": jscToolsMock,
"{CONTROLLER_DIR}/lib/letsencrypt.js": jscLEMock,
"{CONTROLLER_DIR}/lib/letsencrypt": jscLEMock,
}
});
const path = require("path");
const {
tests,
utils
} = require("@iobroker/testing");
const MiioControllerClass = require("../lib/miio");
const {
expect
} = require("chai");
// Run unit tests - See https://github.com/ioBroker/testing for a detailed explanation and further options
tests.unit(path.join(__dirname, ".."), {
defineAdditionalTests() {
// Create mocks and asserts
const {
adapter,
database
} = utils.unit.createMocks();
const controller = new MiioControllerClass({});
let deviceId = 1;
/**
*
* @param {string} vendor
* @param {string} type
* @param {string} version
*/
function runOneDeviceTest(vendor, type, version, states) {
'use strict';
const path = require('path');
const {tests} = require('@iobroker/testing');
// Run tests
tests.unit(path.join(__dirname, '..'), {
defineMockBehavior(db, adapter) {
adapter.getObjectView.returns({rows: []});
}
});