File tree 7 files changed +31
-7
lines changed
7 files changed +31
-7
lines changed Original file line number Diff line number Diff line change @@ -25,13 +25,13 @@ describe('Unit Tests', () => {
25
25
26
26
it ( 'Service uses the NAME override' , async ( ) => {
27
27
process . env . NAME = 'Cloud' ;
28
- const response = await request . get ( '/' ) . expect ( 200 ) ;
28
+ const response = await request . get ( '/' ) . retry ( 3 ) . expect ( 200 ) ;
29
29
assert . equal ( response . text , 'Hello Cloud!' ) ;
30
30
} ) ;
31
31
32
32
it ( 'Service uses the NAME default' , async ( ) => {
33
33
process . env . NAME = '' ;
34
- const response = await request . get ( '/' ) . expect ( 200 ) ;
34
+ const response = await request . get ( '/' ) . retry ( 3 ) . expect ( 200 ) ;
35
35
assert . equal ( response . text , 'Hello World!' ) ;
36
36
} ) ;
37
37
} ) ;
Original file line number Diff line number Diff line change @@ -28,13 +28,14 @@ describe('Unit Tests', () => {
28
28
} ) ;
29
29
30
30
it ( 'should reject request without JWT token' , async ( ) => {
31
- await request . post ( '/' ) . expect ( 401 ) ;
31
+ await request . post ( '/' ) . retry ( 3 ) . expect ( 401 ) ;
32
32
} ) ;
33
33
34
34
it ( 'should reject request with invalid JWT token' , async ( ) => {
35
35
await request
36
36
. post ( '/' )
37
37
. set ( 'Authorization' , 'Bearer iam-a-token' )
38
+ . retry ( 3 )
38
39
. expect ( 403 ) ;
39
40
} ) ;
40
41
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ describe('Unit Tests', () => {
19
19
. post ( '/' )
20
20
. type ( 'json' )
21
21
. send ( { nomessage : 'invalid' } )
22
+ . retry ( 3 )
22
23
. expect ( 400 ) ;
23
24
} ) ;
24
25
@@ -35,6 +36,7 @@ describe('Unit Tests', () => {
35
36
data : 'non-JSON value' ,
36
37
} ,
37
38
} )
39
+ . retry ( 3 )
38
40
. expect ( 400 ) ;
39
41
} ) ;
40
42
@@ -48,6 +50,7 @@ describe('Unit Tests', () => {
48
50
data : Buffer . from ( '{ "json": "value" }' ) . toString ( 'base64' ) ,
49
51
} ,
50
52
} )
53
+ . retry ( 3 )
51
54
. expect ( 400 ) ;
52
55
} ) ;
53
56
it ( 'missing just the "name" property' , async ( ) => {
@@ -59,6 +62,7 @@ describe('Unit Tests', () => {
59
62
data : Buffer . from ( '{ "name": "value" }' ) . toString ( 'base64' ) ,
60
63
} ,
61
64
} )
65
+ . retry ( 3 )
62
66
. expect ( 400 ) ;
63
67
} ) ;
64
68
it ( 'missing just the "bucket" property' , async ( ) => {
@@ -70,6 +74,7 @@ describe('Unit Tests', () => {
70
74
data : Buffer . from ( '{ "bucket": "value" }' ) . toString ( 'base64' ) ,
71
75
} ,
72
76
} )
77
+ . retry ( 3 )
73
78
. expect ( 400 ) ;
74
79
} ) ;
75
80
} ) ;
@@ -88,6 +93,7 @@ describe('Integration Tests', () => {
88
93
) . toString ( 'base64' ) ,
89
94
} ,
90
95
} )
96
+ . retry ( 3 )
91
97
. expect ( 204 ) ;
92
98
} ) ;
93
99
} ) ;
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ describe('Editor unit tests', () => {
23
23
it ( 'should successfully load the index page' , async ( ) => {
24
24
const { app} = require ( path . join ( __dirname , '..' , 'app' ) ) ;
25
25
const request = supertest ( app ) ;
26
- await request . get ( '/' ) . expect ( 200 ) ;
26
+ await request . get ( '/' ) . retry ( 3 ) . expect ( 200 ) ;
27
27
} ) ;
28
28
} ) ;
29
29
@@ -53,7 +53,7 @@ describe('Integration tests', () => {
53
53
} ) ;
54
54
55
55
it ( 'responds 404 Not Found on "GET /render"' , async ( ) => {
56
- await request . get ( '/render' ) . expect ( 404 ) ;
56
+ await request . get ( '/render' ) . retry ( 3 ) . expect ( 404 ) ;
57
57
} ) ;
58
58
59
59
it ( 'responds 200 OK on "POST /render" with valid JSON' , async ( ) => {
@@ -64,6 +64,7 @@ describe('Integration tests', () => {
64
64
. type ( 'json' )
65
65
. set ( 'Accept' , 'text/html' )
66
66
. send ( { data : 'markdown' } )
67
+ . retry ( 3 )
67
68
. expect ( 200 )
68
69
. expect ( 'content-type' , 'text/html; charset=utf-8' ) ;
69
70
} ) ;
@@ -74,6 +75,7 @@ describe('Integration tests', () => {
74
75
. post ( '/render' )
75
76
. type ( 'json' )
76
77
. send ( 'string: incorrect data type' )
78
+ . retry ( 3 )
77
79
. expect ( 400 ) ;
78
80
} ) ;
79
81
} ) ;
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ describe('Unit Tests', () => {
42
42
. post ( '/' )
43
43
. type ( 'text' )
44
44
. send ( markdown )
45
+ . retry ( 3 )
45
46
. expect ( 200 ) ;
46
47
const body = response . text ;
47
48
assert . equal ( body , '<p><strong>markdown text</strong></p>\n' ) ;
@@ -53,6 +54,7 @@ describe('Unit Tests', () => {
53
54
. post ( '/' )
54
55
. type ( 'text' )
55
56
. send ( markdown )
57
+ . retry ( 3 )
56
58
. expect ( 200 )
57
59
. then ( res => {
58
60
const body = res . text ;
@@ -67,6 +69,7 @@ describe('Unit Tests', () => {
67
69
. post ( '/' )
68
70
. type ( 'text' )
69
71
. send ( markdown )
72
+ . retry ( 3 )
70
73
. expect ( 200 )
71
74
. then ( res => {
72
75
const body = res . text ;
Original file line number Diff line number Diff line change @@ -34,19 +34,25 @@ describe('Unit Tests', () => {
34
34
35
35
describe ( 'should fail' , ( ) => {
36
36
it ( 'on a Bad Request with an empty payload' , async ( ) => {
37
- await request . post ( '/' ) . type ( 'json' ) . send ( '' ) . expect ( 400 ) ;
37
+ await request . post ( '/' ) . type ( 'json' ) . send ( '' ) . retry ( 3 ) . expect ( 400 ) ;
38
38
} ) ;
39
39
40
40
it ( 'on a Bad Request with an invalid payload' , async ( ) => {
41
41
await request
42
42
. post ( '/' )
43
43
. type ( 'json' )
44
44
. send ( { nomessage : 'invalid' } )
45
+ . retry ( 3 )
45
46
. expect ( 400 ) ;
46
47
} ) ;
47
48
48
49
it ( 'on a Bad Request with an invalid mimetype' , async ( ) => {
49
- await request . post ( '/' ) . type ( 'text' ) . send ( '{message: true}' ) . expect ( 400 ) ;
50
+ await request
51
+ . post ( '/' )
52
+ . type ( 'text' )
53
+ . send ( '{message: true}' )
54
+ . retry ( 3 )
55
+ . expect ( 400 ) ;
50
56
} ) ;
51
57
} ) ;
52
58
@@ -65,6 +71,7 @@ describe('Unit Tests', () => {
65
71
. post ( '/' )
66
72
. type ( 'json' )
67
73
. send ( { message : true } )
74
+ . retry ( 3 )
68
75
. expect ( 204 )
69
76
. expect ( ( ) => assert . ok ( console . log . calledWith ( 'Hello World!' ) ) ) ;
70
77
} ) ;
@@ -77,6 +84,7 @@ describe('Unit Tests', () => {
77
84
. post ( '/' )
78
85
. type ( 'json' )
79
86
. send ( { message : { data} } )
87
+ . retry ( 3 )
80
88
. expect ( 204 )
81
89
. expect ( ( ) => assert . ok ( console . log . calledWith ( `Hello ${ name } !` ) ) ) ;
82
90
} ) ;
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ describe('Unit Tests', () => {
28
28
await request
29
29
. get ( '/diagram.png' )
30
30
. type ( 'text' )
31
+ . retry ( 3 )
31
32
. expect ( 400 )
32
33
. expect ( 'Content-Type' , errorContentType )
33
34
. expect ( res => {
@@ -42,6 +43,7 @@ describe('Unit Tests', () => {
42
43
. get ( '/diagram.png' )
43
44
. type ( 'text' )
44
45
. query ( { dot : '' } )
46
+ . retry ( 3 )
45
47
. expect ( 400 )
46
48
. expect ( 'Content-Type' , errorContentType )
47
49
. expect ( res => {
@@ -56,6 +58,7 @@ describe('Unit Tests', () => {
56
58
. get ( '/diagram.png' )
57
59
. type ( 'text' )
58
60
. query ( { dot : 'digraph' } )
61
+ . retry ( 3 )
59
62
. expect ( 400 )
60
63
. expect ( 'Content-Type' , errorContentType )
61
64
. expect ( res => {
@@ -72,6 +75,7 @@ describe('Unit Tests', () => {
72
75
. get ( '/diagram.png' )
73
76
. type ( 'text' )
74
77
. query ( { dot : 'digraph G { A -> {B, C, D} -> {F} }' } )
78
+ . retry ( 3 )
75
79
. expect ( 200 )
76
80
. expect ( 'Content-Type' , 'image/png' )
77
81
. expect ( 'Cache-Control' , 'public, max-age=86400' ) ;
You can’t perform that action at this time.
0 commit comments