Updates
This commit is contained in:
@@ -34,3 +34,24 @@ test('login prompts when passphrase arg missing', async (t) => {
|
||||
t.is(unlocked, 'secret-pass')
|
||||
t.is(logs.length, 0)
|
||||
})
|
||||
|
||||
test('login requests masked shell prompt when readLine exists', async (t) => {
|
||||
const run = await loadLoginBin()
|
||||
/** @type {unknown} */
|
||||
let capturedOpts = null
|
||||
let unlocked = ''
|
||||
const ctx = {
|
||||
console: { log: () => {}, error: () => {} },
|
||||
readLine: async (_prompt, opts) => {
|
||||
capturedOpts = opts
|
||||
return 'secret-from-shell'
|
||||
},
|
||||
applyRegister: async () => {},
|
||||
applyUnlock: async (p) => {
|
||||
unlocked = p
|
||||
}
|
||||
}
|
||||
await run(ctx, ['login'])
|
||||
t.alike(capturedOpts, { mask: true })
|
||||
t.is(unlocked, 'secret-from-shell')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user