@@ -2,6 +2,7 @@ package respond
2
2
3
3
import (
4
4
"testing"
5
+
5
6
"github.com/stretchr/testify/assert"
6
7
)
7
8
@@ -10,7 +11,7 @@ func TestNotFound(test *testing.T) {
10
11
statusCode , result := Default .NotFound ()
11
12
12
13
assert .Equal (test , 404 , statusCode )
13
- assert .Equal (test , map [string ] interface {} {
14
+ assert .Equal (test , map [string ]interface {}{
14
15
"message" : "Oops... The requested page not found!" ,
15
16
"status" : "failed" ,
16
17
"error" : 5404 ,
@@ -19,14 +20,14 @@ func TestNotFound(test *testing.T) {
19
20
20
21
func TestSucceed (test * testing.T ) {
21
22
22
- statusCode , result := Default .Succeed (map [string ] interface {} {
23
+ statusCode , result := Default .Succeed (map [string ]interface {}{
23
24
"data" : "Test" ,
24
25
})
25
26
26
27
assert .Equal (test , 200 , statusCode )
27
- assert .Equal (test , map [string ] interface {} {
28
+ assert .Equal (test , map [string ]interface {}{
28
29
"status" : "success" ,
29
- "result" : map [string ] interface {} {
30
+ "result" : map [string ]interface {}{
30
31
"data" : "Test" ,
31
32
},
32
33
}, result )
@@ -37,7 +38,7 @@ func TestInsertSucceeded(test *testing.T) {
37
38
statusCode , result := Default .InsertSucceeded ()
38
39
39
40
assert .Equal (test , 200 , statusCode )
40
- assert .Equal (test , map [string ] interface {} {
41
+ assert .Equal (test , map [string ]interface {}{
41
42
"message" : "The requested parameter is added successfully!" ,
42
43
"status" : "success" ,
43
44
}, result )
@@ -48,7 +49,7 @@ func TestInsertFailed(test *testing.T) {
48
49
statusCode , result := Default .InsertFailed ()
49
50
50
51
assert .Equal (test , 448 , statusCode )
51
- assert .Equal (test , map [string ] interface {} {
52
+ assert .Equal (test , map [string ]interface {}{
52
53
"message" : "The requested parameter is not added!" ,
53
54
"status" : "failed" ,
54
55
}, result )
@@ -59,7 +60,7 @@ func TestDeleteSucceeded(test *testing.T) {
59
60
statusCode , result := Default .DeleteSucceeded ()
60
61
61
62
assert .Equal (test , 200 , statusCode )
62
- assert .Equal (test , map [string ] interface {} {
63
+ assert .Equal (test , map [string ]interface {}{
63
64
"message" : "The requested parameter is deleted successfully!" ,
64
65
"status" : "success" ,
65
66
}, result )
@@ -70,7 +71,7 @@ func TestDeleteFailed(test *testing.T) {
70
71
statusCode , result := Default .DeleteFailed ()
71
72
72
73
assert .Equal (test , 447 , statusCode )
73
- assert .Equal (test , map [string ] interface {} {
74
+ assert .Equal (test , map [string ]interface {}{
74
75
"message" : "The requested parameter is not deleted!" ,
75
76
"status" : "failed" ,
76
77
}, result )
@@ -81,7 +82,7 @@ func TestUpdateSucceeded(test *testing.T) {
81
82
statusCode , result := Default .UpdateSucceeded ()
82
83
83
84
assert .Equal (test , 200 , statusCode )
84
- assert .Equal (test , map [string ] interface {} {
85
+ assert .Equal (test , map [string ]interface {}{
85
86
"message" : "The requested parameter is updated successfully!" ,
86
87
"status" : "success" ,
87
88
}, result )
@@ -92,7 +93,7 @@ func TestUpdateFailed(test *testing.T) {
92
93
statusCode , result := Default .UpdateFailed ()
93
94
94
95
assert .Equal (test , 449 , statusCode )
95
- assert .Equal (test , map [string ] interface {} {
96
+ assert .Equal (test , map [string ]interface {}{
96
97
"message" : "The requested parameter is not updated!" ,
97
98
"status" : "failed" ,
98
99
}, result )
@@ -103,7 +104,7 @@ func TestWrongParameters(test *testing.T) {
103
104
statusCode , result := Default .WrongParameters ()
104
105
105
106
assert .Equal (test , 406 , statusCode )
106
- assert .Equal (test , map [string ] interface {} {
107
+ assert .Equal (test , map [string ]interface {}{
107
108
"message" : "Oops... The parameters you entered are wrong!" ,
108
109
"status" : "failed" ,
109
110
"error" : 5406 ,
@@ -115,7 +116,7 @@ func TestMethodNotAllowed(test *testing.T) {
115
116
statusCode , result := Default .MethodNotAllowed ()
116
117
117
118
assert .Equal (test , 405 , statusCode )
118
- assert .Equal (test , map [string ] interface {} {
119
+ assert .Equal (test , map [string ]interface {}{
119
120
"message" : "Oops... The method you requested is not allowed!" ,
120
121
"status" : "failed" ,
121
122
"error" : 5405 ,
@@ -124,14 +125,14 @@ func TestMethodNotAllowed(test *testing.T) {
124
125
125
126
func TestValidationErrors (test * testing.T ) {
126
127
127
- statusCode , result := Default .ValidationErrors (map [string ] interface {} {
128
+ statusCode , result := Default .ValidationErrors (map [string ]interface {}{
128
129
"data" : "Test" ,
129
130
})
130
131
131
132
assert .Equal (test , 420 , statusCode )
132
- assert .Equal (test , map [string ] interface {} {
133
+ assert .Equal (test , map [string ]interface {}{
133
134
"status" : "failed" ,
134
- "result" : map [string ] interface {} {
135
+ "result" : map [string ]interface {}{
135
136
"data" : "Test" ,
136
137
},
137
138
}, result )
@@ -142,7 +143,7 @@ func TestRequestFieldNotfound(test *testing.T) {
142
143
statusCode , result := Default .RequestFieldNotfound ()
143
144
144
145
assert .Equal (test , 446 , statusCode )
145
- assert .Equal (test , map [string ] interface {} {
146
+ assert .Equal (test , map [string ]interface {}{
146
147
"status" : "failed" ,
147
148
"error" : 1001 ,
148
149
"message" : "Oops... Requested field is not found!" ,
@@ -154,7 +155,7 @@ func TestRequestFieldDuplicated(test *testing.T) {
154
155
statusCode , result := Default .RequestFieldDuplicated ()
155
156
156
157
assert .Equal (test , 400 , statusCode )
157
- assert .Equal (test , map [string ] interface {} {
158
+ assert .Equal (test , map [string ]interface {}{
158
159
"status" : "failed" ,
159
160
"error" : 1004 ,
160
161
"message" : "Failed because of duplicate" ,
@@ -166,7 +167,7 @@ func TestDefaultWithLang(test *testing.T) {
166
167
statusCode , result := DefaultWithLang ("fa" ).NotFound ()
167
168
168
169
assert .Equal (test , 404 , statusCode )
169
- assert .Equal (test , map [string ] interface {} {
170
+ assert .Equal (test , map [string ]interface {}{
170
171
"status" : "نا موفق" ,
171
172
"error" : 5404 ,
172
173
"message" : ".صفحه درخواست شده پیدا نمیشود" ,
0 commit comments