Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
CMCDragonkai committed May 6, 2022
1 parent 9b20b0b commit c5dd322
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
10 changes: 9 additions & 1 deletion src/native/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import path from 'path';
import nodeGypBuild from 'node-gyp-build';

interface Native {
addOne(n: number): number;
timesTwo(n: number): number;
createArr(): [number];
createObj(): { key: string };
setProperty(obj: { key1: string }): { key1: string; key2: string };
}

// Path to project root containing package.json and binding.gyp
const native = nodeGypBuild(path.join(__dirname, '../../'));
const native: Native = nodeGypBuild(path.join(__dirname, '../../'));

export default native;
7 changes: 4 additions & 3 deletions tests/lib/native.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ describe('native bindings', () => {
// expect(native.createObj()).toStrictEqual({ key: 'hello world' });
});
test('set property', () => {
expect(
native.setProperty({ key1: 'value1' })
).toStrictEqual({ key1: 'value1', key2: 'initial value1'});
expect(native.setProperty({ key1: 'value1' })).toStrictEqual({
key1: 'value1',
key2: 'initial value1',
});
});
});

0 comments on commit c5dd322

Please sign in to comment.