Skip to content

Commit c5dd322

Browse files
committed
WIP
1 parent 9b20b0b commit c5dd322

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/native/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
import path from 'path';
22
import nodeGypBuild from 'node-gyp-build';
33

4+
interface Native {
5+
addOne(n: number): number;
6+
timesTwo(n: number): number;
7+
createArr(): [number];
8+
createObj(): { key: string };
9+
setProperty(obj: { key1: string }): { key1: string; key2: string };
10+
}
11+
412
// Path to project root containing package.json and binding.gyp
5-
const native = nodeGypBuild(path.join(__dirname, '../../'));
13+
const native: Native = nodeGypBuild(path.join(__dirname, '../../'));
614

715
export default native;

tests/lib/native.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ describe('native bindings', () => {
2424
// expect(native.createObj()).toStrictEqual({ key: 'hello world' });
2525
});
2626
test('set property', () => {
27-
expect(
28-
native.setProperty({ key1: 'value1' })
29-
).toStrictEqual({ key1: 'value1', key2: 'initial value1'});
27+
expect(native.setProperty({ key1: 'value1' })).toStrictEqual({
28+
key1: 'value1',
29+
key2: 'initial value1',
30+
});
3031
});
3132
});

0 commit comments

Comments
 (0)