Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit dc894e7

Browse files
test: add cli/key
1 parent 03bbaf8 commit dc894e7

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

test/cli/key.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/* eslint-env mocha */
2+
'use strict'
3+
4+
const expect = require('chai').expect
5+
const runOnAndOff = require('../utils/on-and-off')
6+
const hat = require('hat')
7+
8+
describe('key', () => runOnAndOff.off((thing) => {
9+
const name = 'test-key-' + hat()
10+
const newName = 'test-key-' + hat()
11+
let ipfs
12+
13+
before(() => {
14+
ipfs = thing.ipfs
15+
})
16+
17+
it('gen', function () {
18+
this.timeout(40 * 1000)
19+
20+
return ipfs(`key gen ${name} --type rsa --size 2048`)
21+
.then((out) => {
22+
expect(out).to.include(`generated ${name}`)
23+
})
24+
})
25+
26+
it('list', function () {
27+
this.timeout(20 * 1000)
28+
29+
return ipfs('key list')
30+
.then((out) => {
31+
expect(out).to.include(name)
32+
})
33+
})
34+
35+
it('rename', function () {
36+
this.timeout(20 * 1000)
37+
38+
return ipfs(`key rename ${name} ${newName}`)
39+
.then((out) => {
40+
expect(out).to.include(`renamed to ${newName}`)
41+
})
42+
})
43+
44+
it('rm', function () {
45+
this.timeout(20 * 1000)
46+
47+
return ipfs(`key rm ${newName}`)
48+
.then((out) => {
49+
expect(out).to.include(newName)
50+
})
51+
})
52+
}))

0 commit comments

Comments
 (0)