UNPKG

johnny-five

Version:

The JavaScript Robotics and Hardware Programming Framework. Use with: Arduino (all models), Electric Imp, Beagle Bone, Intel Galileo & Edison, Linino One, Pinoccio, pcDuino3, Raspberry Pi, Particle/Spark Core & Photon, Tessel 2, TI Launchpad and more!

79 lines (73 loc) 1.19 kB
var Options = require("../lib/board.options.js"); exports["static"] = { // Transform string, number and array args into // options objects with pin or pins property. "Options": function(test) { var tests = [{ opt: 0, result: { pin: 0 } }, { opt: 9, result: { pin: 9 } }, { opt: "A0", result: { pin: "A0" } }, { opt: ["A0", "A1"], result: { pins: ["A0", "A1"] } }, { opt: [5, 6], result: { pins: [5, 6] } }, { opt: { pin: 0 }, result: { pin: 0 } }, { opt: { pin: 9 }, result: { pin: 9 } }, { opt: { pin: "A0" }, result: { pin: "A0" } }, { opt: { pins: ["A0", "A1"] }, result: { pins: ["A0", "A1"] } }, { opt: { pins: [5, 6] }, result: { pins: [5, 6] } }]; test.expect(tests.length); tests.forEach(function(set) { test.deepEqual(new Options(set.opt), set.result); }); test.done(); } };