How to use the @iobroker/testing.tests.unit function in @iobroker/testing

To help you get started, we’ve selected a few @iobroker/testing examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Zefau / ioBroker.hue-extended / test / unit.js View on Github external
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] });
github iobroker-community-adapters / ioBroker.sourceanalytix / test / unit.js View on Github external
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: []});
    }
});
github ioBroker / ioBroker.hm-rega / test / unitAdapter.js View on Github external
'use strict';

const path = require('path');
const {tests} = require('@iobroker/testing');

// Run tests
tests.unit(path.join(__dirname, '..'));
github Zefau / ioBroker.roomba / test / unit.js View on Github external
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] });
github Apollon77 / ioBroker.tuya / test / unit.js View on Github external
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 });
github ioBroker / ioBroker.admin / test / unit.js View on Github external
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,
	}
});
github SchumyHao / ioBroker.miio / test / unit.js View on Github external
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) {
github ioBroker / ioBroker.hm-rpc / test / unitAdapter.js View on Github external
'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: []});
    }
});
github simatec / ioBroker.backitup / test / unit.js View on Github external
const path = require('path');
const { tests } = require('@iobroker/testing');

const jscToolsMock = {
	// No update checks in unit tests
	getInstalledInfo() { return {}; },
};

// 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,
	}
});
github Apollon77 / ioBroker.meross / test / unit.js View on Github external
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 });

@iobroker/testing

Shared utilities for adapter and module testing in ioBroker

MIT
Latest version published 2 months ago

Package Health Score

72 / 100
Full package analysis