@@ -21,3 +21,63 @@ test('should send referer http header', function (t) {
21
21
} )
22
22
} )
23
23
} )
24
+
25
+ test ( 'should redact user secret from hook add command' , function ( t ) {
26
+ http . createServer ( function ( q , s ) {
27
+ t . equal ( q . headers . referer , 'hook add ~zkat [REDACTED] [REDACTED]' )
28
+ s . statusCode = 204
29
+ s . end ( )
30
+ this . close ( )
31
+ } ) . listen ( common . port , function ( ) {
32
+ var reg = `http://localhost:${ common . port } `
33
+ var args = [ 'hook' , 'add' , '~zkat' , 'https://example.com' , 'sekrit' , '--registry' , reg ]
34
+ common . npm ( args , { } , function ( er , code ) {
35
+ if ( er ) {
36
+ throw er
37
+ }
38
+ // should not have ended nicely, since we returned an error
39
+ t . ok ( code )
40
+ t . end ( )
41
+ } )
42
+ } )
43
+ } )
44
+
45
+ test ( 'should redact user secret from hook up command' , function ( t ) {
46
+ http . createServer ( function ( q , s ) {
47
+ t . equal ( q . headers . referer , 'hook up ~zkat [REDACTED] [REDACTED]' )
48
+ s . statusCode = 204
49
+ s . end ( )
50
+ this . close ( )
51
+ } ) . listen ( common . port , function ( ) {
52
+ var reg = `http://localhost:${ common . port } `
53
+ var args = [ 'hook' , 'up' , '~zkat' , 'https://example.com' , 'sekrit' , '--registry' , reg ]
54
+ common . npm ( args , { } , function ( er , code ) {
55
+ if ( er ) {
56
+ throw er
57
+ }
58
+ // should not have ended nicely, since we returned an error
59
+ t . ok ( code )
60
+ t . end ( )
61
+ } )
62
+ } )
63
+ } )
64
+
65
+ test ( 'should redact user secret from hook update command' , function ( t ) {
66
+ http . createServer ( function ( q , s ) {
67
+ t . equal ( q . headers . referer , 'hook update ~zkat [REDACTED] [REDACTED]' )
68
+ s . statusCode = 204
69
+ s . end ( )
70
+ this . close ( )
71
+ } ) . listen ( common . port , function ( ) {
72
+ var reg = `http://localhost:${ common . port } `
73
+ var args = [ 'hook' , 'update' , '~zkat' , 'https://example.com' , 'sekrit' , '--registry' , reg ]
74
+ common . npm ( args , { } , function ( er , code ) {
75
+ if ( er ) {
76
+ throw er
77
+ }
78
+ // should not have ended nicely, since we returned an error
79
+ t . ok ( code )
80
+ t . end ( )
81
+ } )
82
+ } )
83
+ } )
0 commit comments