3
3
const expect = require ( 'chai' ) . expect ;
4
4
const oc = require ( '../../dist/index' ) ;
5
5
const path = require ( 'path' ) ;
6
- const request = require ( 'minimal-request ' ) ;
6
+ const got = require ( 'got ' ) ;
7
7
8
8
describe ( 'registry (ui interface)' , ( ) => {
9
9
let registry ;
10
10
let result ;
11
11
let error ;
12
12
let headers ;
13
13
14
- const next = done => ( e , r , d ) => {
15
- error = e ;
16
- result = r ;
17
- headers = d . response . headers ;
18
- done ( ) ;
14
+ const next = ( promise , done ) => {
15
+ promise
16
+ . then ( r => {
17
+ headers = r . headers ;
18
+ result = r . body ;
19
+ } )
20
+ . catch ( e => ( error = e ) )
21
+ . finally ( done ) ;
19
22
} ;
20
23
21
24
const conf = {
@@ -40,17 +43,16 @@ describe('registry (ui interface)', () => {
40
43
41
44
describe ( 'GET / with Accept: text/html' , ( ) => {
42
45
before ( done => {
43
- request (
44
- {
45
- url : 'http://localhost:3030' ,
46
+ next (
47
+ got ( 'http://localhost:3030' , {
46
48
headers : { accept : 'text/html' }
47
- } ,
48
- next ( done )
49
+ } ) ,
50
+ done
49
51
) ;
50
52
} ) ;
51
53
52
54
it ( 'should not error' , ( ) => {
53
- expect ( error ) . to . be . null ;
55
+ expect ( error ) . to . be . undefined ;
54
56
} ) ;
55
57
56
58
it ( 'should respond with html result' , ( ) => {
@@ -61,17 +63,16 @@ describe('registry (ui interface)', () => {
61
63
62
64
describe ( 'GET /oc-client/~info with Accept: text/html' , ( ) => {
63
65
before ( done => {
64
- request (
65
- {
66
- url : 'http://localhost:3030/oc-client/~info' ,
66
+ next (
67
+ got ( 'http://localhost:3030/oc-client/~info' , {
67
68
headers : { accept : 'text/html' }
68
- } ,
69
- next ( done )
69
+ } ) ,
70
+ done
70
71
) ;
71
72
} ) ;
72
73
73
74
it ( 'should not error' , ( ) => {
74
- expect ( error ) . to . be . null ;
75
+ expect ( error ) . to . be . undefined ;
75
76
} ) ;
76
77
77
78
it ( 'should respond with html result' , ( ) => {
0 commit comments