Skip to content

Fixture valid: Detect out-of-range DMX values #966

Open
@fxedel

Description

@fxedel

Steps to reproduce

Create a capability that exceeds the maximum DMX value, like so:

    "Mode": {
      "defaultValue": 0,
      "capabilities": [
        {
          "dmxRange": [0, 239],
          "type": "NoFunction"
        },
        {
          "dmxRange": [240, 299],
          "type": "Effect",
          "effectName": "Sound-active",
          "soundControlled": true
        }
      ]
    }

The fixture valid test fails, but primarily because of an error thrown in scale-dmx-values module.

[FAIL] boomtonedj/silentpar-7x10w-5in1.json
└ Error: File could not be imported into model. Error: Given DMX value was outside the given resolution
    at getBytes (/home/felix/Development/open-fixture-library/lib/scale-dmx-values.mjs:105:11)
    at scaleDmxRangeIndividually (/home/felix/Development/open-fixture-library/lib/scale-dmx-values.mjs:44:20)
    at scaleDmxRange (/home/felix/Development/open-fixture-library/lib/scale-dmx-values.mjs:31:10)
    at Capability.getDmxRangeWithResolution (/home/felix/Development/open-fixture-library/lib/model/Capability.mjs:313:72)
    at Capability.get rawDmxRange [as rawDmxRange] (/home/felix/Development/open-fixture-library/lib/model/Capability.mjs:302:17)
    at checkRangeValid (/home/felix/Development/open-fixture-library/tests/fixture-valid.js:484:19)
    at checkDmxRange (/home/felix/Development/open-fixture-library/tests/fixture-valid.js:462:14)
    at checkCapabilities (/home/felix/Development/open-fixture-library/tests/fixture-valid.js:447:31)
    at checkChannel (/home/felix/Development/open-fixture-library/tests/fixture-valid.js:415:5)
    at checkChannels (/home/felix/Development/open-fixture-library/tests/fixture-valid.js:368:9)

Expected behavior

The error should be catched directly by the fixture-valid test, so that the error string includes information about which channel and which capability is affected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component-testAffects the automated tests.difficulty-easyImplementation is relatively straighforward.good first issueEasy to pick up for new contributors. Only little domain knowledge required.hacktoberfestGood issue for users participating in the Hacktoberfest.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions