-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
037d2e7
commit e4b961e
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import Orbiter from './lib/orbiter.js' | ||
import Lander from './lib/lander.js' | ||
import RPC from './rpc-client.js' | ||
|
||
export { | ||
Orbiter, | ||
Lander | ||
Lander, | ||
RPC | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { deepStrictEqual } from 'assert' | ||
import { rimraf } from 'rimraf' | ||
import { RPC } from '../src/index.js' | ||
import { spawn } from 'node:child_process' | ||
import waitForDaemonStarted from './utils/wait-for-daemon-start.js' | ||
|
||
describe('RPC', function () { | ||
let daemon | ||
let rpc | ||
|
||
before(async function () { | ||
daemon = spawn('./src/bin/cli.js', ['daemon']) | ||
|
||
await waitForDaemonStarted(daemon) | ||
|
||
rpc = await RPC({ directory: '' }) | ||
}) | ||
|
||
after(async function () { | ||
daemon.kill() | ||
await rimraf('voyager') | ||
}) | ||
|
||
it('adds an authorized user', async function () { | ||
const id = '037ba2545db2e2ec0ba17fc9b35fbbf6bc09db82c9ab324521e62693e8aa96ceb4' | ||
await rpc.authAdd({ id }) | ||
const { message } = await rpc.authList() | ||
deepStrictEqual(message, [id]) | ||
}) | ||
|
||
it('removes an authorized user', async function () { | ||
const id = '037ba2545db2e2ec0ba17fc9b35fbbf6bc09db82c9ab324521e62693e8aa96ceb4' | ||
await rpc.authAdd({ id }) | ||
await rpc.authDel({ id }) | ||
const { message } = await rpc.authList() | ||
deepStrictEqual(message, []) | ||
}) | ||
}) |