Add a Node.js wrapper library

The implementation is very similar to the Python wrapper.
This commit is contained in:
Oliver Hamlet
2025-04-22 19:22:31 +01:00
parent cb4686b0b9
commit 5a33e16eb3
12 changed files with 4504 additions and 1183 deletions
+21 -3
View File
@@ -1,7 +1,25 @@
import test from 'ava'
import { sum } from '../index.js'
import { liblootVersion, isCompatible, Group } from '../index.js'
test('sum from native', (t) => {
t.is(sum(1, 2), 3)
test('liblootVersion', t => {
t.is(liblootVersion(), "0.26.0")
});
test('isCompatible', t => {
t.is(isCompatible(0, 26, 0), true)
});
test('Group equality', t => {
const group1 = new Group("A");
const group2 = new Group("A");
const group3 = new Group("B");
t.deepEqual(group1.name, group2.name);
t.notDeepEqual(group1.name, group3.name);
t.deepEqual(group1, group2);
// The objects have no public fields so appear to be equal.
t.deepEqual(group1, group3);
})