This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree 3 files changed +54
-0
lines changed
3 files changed +54
-0
lines changed Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ const cmds = require ( '../cmd-helpers' )
4
+
5
+ module . exports = ( send ) => {
6
+ return {
7
+ gc : cmds . command ( send , 'repo/gc' ) ,
8
+ stat : cmds . command ( send , 'repo/stat' )
9
+ }
10
+ }
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ function requireCommands () {
21
21
pin : require ( './api/pin' ) ,
22
22
ping : require ( './api/ping' ) ,
23
23
refs : require ( './api/refs' ) ,
24
+ repo : require ( './api/repo' ) ,
24
25
swarm : require ( './api/swarm' ) ,
25
26
update : require ( './api/update' ) ,
26
27
version : require ( './api/version' )
Original file line number Diff line number Diff line change
1
+ /* eslint-env mocha */
2
+ /* globals apiClients */
3
+ 'use strict'
4
+
5
+ const expect = require ( 'chai' ) . expect
6
+
7
+ describe ( '.repo' , ( ) => {
8
+ it ( '.repo.gc' , ( done ) => {
9
+ apiClients . a . repo . gc ( ( err , res ) => {
10
+ expect ( err ) . to . not . exist
11
+ expect ( res ) . to . exist
12
+ done ( )
13
+ } )
14
+ } )
15
+
16
+ it ( '.repo.stat' , ( done ) => {
17
+ apiClients . a . repo . stat ( ( err , res ) => {
18
+ expect ( err ) . to . not . exist
19
+ expect ( res ) . to . exist
20
+ expect ( res ) . to . have . a . property ( 'NumObjects' )
21
+ expect ( res ) . to . have . a . property ( 'RepoSize' )
22
+ done ( )
23
+ } )
24
+ } )
25
+
26
+ describe ( 'promise' , ( ) => {
27
+ it ( '.repo.gc' , ( ) => {
28
+ return apiClients . a . repo . gc ( )
29
+ . then ( ( res ) => {
30
+ expect ( res ) . to . exist
31
+ } )
32
+ } )
33
+
34
+ it ( '.repo.stat' , ( ) => {
35
+ return apiClients . a . repo . stat ( )
36
+ . then ( ( res ) => {
37
+ expect ( res ) . to . exist
38
+ expect ( res ) . to . have . a . property ( 'NumObjects' )
39
+ expect ( res ) . to . have . a . property ( 'RepoSize' )
40
+ } )
41
+ } )
42
+ } )
43
+ } )
You can’t perform that action at this time.
0 commit comments