How to use the @iobroker/testing.utils.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 SchumyHao / ioBroker.miio / test / unit.js View on Github external
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) {
            const model = `${vendor}.${type}.${version}`;
            it(model, () => {
                const id = deviceId++;
                controller.registerDevice({
                    id: `miio:${id}`,
                    management: {

@iobroker/testing

Shared utilities for adapter and module testing in ioBroker

MIT
Latest version published 1 month ago

Package Health Score

73 / 100
Full package analysis