uci-i2c-device/test/device.test.js

26 lines
633 B
JavaScript
Raw Normal View History

'use strict'
const chai = require('chai'),
chaiAsPromised = require("chai-as-promised"),
Bus = require('../lib/bus').Bus,
Device = require('../lib/device').Device
// _ = require('uci-utils')
chai.use(chaiAsPromised);
const expect = chai.expect
let bus = new Bus()
let device = new Device(bus, 0x20)
describe('Device Class - ', function () {
let SET = 0xff
it('Can write and read to actual device', function () {
device.write(0x09, SET).then(expect(device.read(0x0A)).to.eventually.equal(SET))
.then(setTimeout(() => device.write(0x09, 0), 3000))
.catch(err => console.log("an error", err))
})
})