Skip to content

Commit

Permalink
perf(I2cBus): Improve types
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroHerr committed Dec 15, 2018
1 parent ddc7b04 commit 5fc97a0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/lib/createI2cBusMock.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BufferCallback, CompletionCallback, I2cBus, I2cBusFuncs, ResultCallback } from 'i2c-bus';
import { BufferCallback, CompletionCallback, I2cBus, I2cBusFuncs, open, ResultCallback } from 'i2c-bus';

const defaultI2cBusFuncs = {
i2c: false,
Expand All @@ -21,13 +21,13 @@ const defaultI2cBusFuncs = {
};

// @TODO Add full features
export default ({
const createI2cBusMock = ({
devices = {},
i2cBusFuncs = defaultI2cBusFuncs,
}: {
devices?: { [address: number]: Buffer };
i2cBusFuncs?: I2cBusFuncs;
} = {}) => (_: number, openCallback: CompletionCallback): I2cBus => {
} = {}): typeof open => (_: number, openCallback: CompletionCallback): I2cBus => {
openCallback(null);

return {
Expand Down Expand Up @@ -120,3 +120,5 @@ export default ({
},
};
};

export default createI2cBusMock;

0 comments on commit 5fc97a0

Please sign in to comment.