@tiledesk/tiledesk-server 2.10.14 → 2.10.16
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +9 -0
- package/app.js +2 -1
- package/models/request.js +8 -0
- package/package.json +4 -3
- package/pubmodules/activities/test/activityRoute.js +6 -2
- package/pubmodules/events/test/eventRoute.js +7 -3
- package/pubmodules/pubModulesManager.js +24 -0
- package/pubmodules/voice-twilio/index.js +6 -0
- package/pubmodules/voice-twilio/listener.js +59 -0
- package/routes/campaigns.js +1 -1
- package/routes/files.js +6 -4
- package/routes/images.js +0 -2
- package/routes/kb.js +7 -1
- package/routes/request.js +10 -0
- package/routes/users.js +2 -2
- package/services/fileGridFsService.js +12 -10
- package/services/requestService.js +2 -1
- package/test/app-test.js +36 -1
- package/test/authentication.js +662 -796
- package/test/authenticationJwt.js +213 -315
- package/test/authorization.js +53 -72
- package/test/campaignsRoute.js +42 -47
- package/test/cannedRoute.js +30 -16
- package/test/departmentService.js +222 -274
- package/test/example.json +31 -1
- package/test/faqRoute.js +713 -622
- package/test/faqService.js +124 -159
- package/test/faqkbRoute.js +128 -100
- package/test/fileRoute.js +50 -46
- package/test/imageRoute.js +263 -254
- package/test/jwtRoute.js +128 -153
- package/test/kbRoute.js +40 -17
- package/test/kbsettingsRoute.js +78 -54
- package/test/keysRoute.js +6 -7
- package/test/labelRoute.js +591 -696
- package/test/labelService.js +40 -47
- package/test/leadService.js +100 -115
- package/test/logsRoute.js +13 -7
- package/test/messageRootRoute.js +112 -102
- package/test/messageRoute.js +1171 -1419
- package/test/messageService.js +41 -43
- package/test/openaiRoute.js +5 -1
- package/test/projectRoute.js +23 -4
- package/test/projectService.js +3 -1
- package/test/quoteManager.js +36 -13
- package/test/requestRoute.js +103 -72
- package/test/requestService.js +51 -51
- package/test/userRoute.js +37 -8
- package/test/userService.js +34 -31
- package/utils/promiseUtil.js +1 -1
package/test/labelRoute.js
CHANGED
@@ -11,6 +11,8 @@ let chaiHttp = require('chai-http');
|
|
11
11
|
let server = require('../app');
|
12
12
|
let should = chai.should();
|
13
13
|
|
14
|
+
let log = false;
|
15
|
+
|
14
16
|
// chai.config.includeStack = true;
|
15
17
|
|
16
18
|
var expect = chai.expect;
|
@@ -20,902 +22,795 @@ chai.use(chaiHttp);
|
|
20
22
|
|
21
23
|
describe('LabelRoute', () => {
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
it('clone', (done) => {
|
25
|
+
describe('/clone', () => {
|
28
26
|
|
29
|
-
|
30
|
-
// this.timeout();
|
27
|
+
it('clone', (done) => {
|
31
28
|
|
32
|
-
|
33
|
-
|
29
|
+
var email = "test-signup-" + Date.now() + "@email.com";
|
30
|
+
var pwd = "pwd";
|
34
31
|
|
35
|
-
|
36
|
-
|
32
|
+
userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
|
33
|
+
projectService.create("test1", savedUser._id).then(function (savedProject) {
|
37
34
|
|
38
|
-
|
39
|
-
.post('/'+ savedProject._id + '/labels/default/clone')
|
35
|
+
chai.request(server)
|
36
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
40
37
|
.auth(email, pwd)
|
41
|
-
.send({lang: "EN"})
|
38
|
+
.send({ lang: "EN" })
|
42
39
|
.end((err, res) => {
|
43
|
-
|
44
|
-
console.
|
40
|
+
|
41
|
+
if (err) { if (err) { console.error("err", err); } }
|
42
|
+
if (log) { console.log("res.body", res.body); }
|
43
|
+
|
45
44
|
res.should.have.status(200);
|
46
45
|
res.body.should.be.a('object');
|
47
|
-
expect(res.body.id_project).to.equal(savedProject.id);
|
46
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
48
47
|
expect(res.body.data[0].default).to.equal(true);
|
49
|
-
expect(res.body.data[0].lang).to.equal("EN");
|
48
|
+
expect(res.body.data[0].lang).to.equal("EN");
|
50
49
|
|
51
|
-
|
52
50
|
done();
|
53
51
|
});
|
54
|
-
|
55
|
-
|
56
52
|
});
|
57
|
-
|
58
|
-
|
59
|
-
});
|
53
|
+
});
|
54
|
+
});
|
60
55
|
|
61
56
|
|
57
|
+
it('cloneENAndGetByLanguageEN', (done) => {
|
62
58
|
|
59
|
+
var email = "test-signup-" + Date.now() + "@email.com";
|
60
|
+
var pwd = "pwd";
|
63
61
|
|
64
|
-
|
62
|
+
userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
|
63
|
+
projectService.create("test1", savedUser._id).then(function (savedProject) {
|
65
64
|
|
66
|
-
|
67
|
-
// this.timeout();
|
68
|
-
|
69
|
-
var email = "test-signup-" + Date.now() + "@email.com";
|
70
|
-
var pwd = "pwd";
|
71
|
-
|
72
|
-
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
73
|
-
projectService.create("test1", savedUser._id).then(function(savedProject) {
|
74
|
-
|
75
65
|
chai.request(server)
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
66
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
67
|
+
.auth(email, pwd)
|
68
|
+
.send({ lang: "EN" })
|
69
|
+
.end((err, res) => {
|
70
|
+
|
71
|
+
if (err) { console.error("err: ", err); }
|
72
|
+
if (log) { console.log("res.body", res.body); }
|
73
|
+
|
74
|
+
res.should.have.status(200);
|
75
|
+
res.body.should.be.a('object');
|
76
|
+
// expect(res.body.jwtSecret).to.not.equal(null);
|
77
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
78
|
+
expect(res.body.data[0].default).to.equal(true);
|
79
|
+
expect(res.body.data[0].lang).to.equal("EN");
|
80
|
+
|
81
|
+
chai.request(server)
|
82
|
+
.get('/' + savedProject._id + '/labels/EN')
|
91
83
|
.auth(email, pwd)
|
92
84
|
.send()
|
93
85
|
.end((err, res) => {
|
94
|
-
|
95
|
-
console.
|
96
|
-
|
86
|
+
|
87
|
+
if (err) { console.error("err: ", err); }
|
88
|
+
if (log) { console.log("res.body", res.body); }
|
89
|
+
|
90
|
+
expect(res.body.data.LABEL_PLACEHOLDER).to.equal("type your message..");
|
97
91
|
expect(res.body.default).to.equal(true);
|
98
|
-
expect(res.body.lang).to.equal("EN");
|
92
|
+
expect(res.body.lang).to.equal("EN");
|
99
93
|
done();
|
100
94
|
});
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
});
|
105
|
-
});
|
106
|
-
|
95
|
+
});
|
96
|
+
});
|
97
|
+
});
|
107
98
|
});
|
108
|
-
|
109
|
-
|
110
99
|
|
111
100
|
|
112
101
|
it('CloneENAndGetByLanguageIT', (done) => {
|
113
102
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
103
|
+
var email = "test-signup-" + Date.now() + "@email.com";
|
104
|
+
var pwd = "pwd";
|
105
|
+
|
106
|
+
userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
|
107
|
+
projectService.create("test1", savedUser._id).then(function (savedProject) {
|
108
|
+
|
109
|
+
chai.request(server)
|
110
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
111
|
+
.auth(email, pwd)
|
112
|
+
.send({ lang: "EN" })
|
113
|
+
.end((err, res) => {
|
114
|
+
|
115
|
+
if (err) { console.error("err: ", err); }
|
116
|
+
if (log) { console.log("res.body", res.body); }
|
117
|
+
|
118
|
+
res.should.have.status(200);
|
119
|
+
res.body.should.be.a('object');
|
120
|
+
// expect(res.body.jwtSecret).to.not.equal(null);
|
121
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
122
|
+
expect(res.body.data[0].default).to.equal(true);
|
123
|
+
expect(res.body.data[0].lang).to.equal("EN");
|
124
|
+
|
125
|
+
chai.request(server)
|
126
|
+
.get('/' + savedProject._id + '/labels/IT')
|
125
127
|
.auth(email, pwd)
|
126
|
-
.send(
|
128
|
+
.send()
|
127
129
|
.end((err, res) => {
|
128
|
-
|
129
|
-
console.
|
130
|
-
res.
|
131
|
-
|
132
|
-
|
133
|
-
expect(res.body.
|
134
|
-
expect(res.body.
|
135
|
-
|
136
|
-
|
137
|
-
chai.request(server)
|
138
|
-
.get('/'+ savedProject._id + '/labels/IT')
|
139
|
-
.auth(email, pwd)
|
140
|
-
.send()
|
141
|
-
.end((err, res) => {
|
142
|
-
//console.log("res", res);
|
143
|
-
console.log("res.body", res.body);
|
144
|
-
expect(res.body.data.LABEL_PLACEHOLDER).to.equal("type your message..");
|
145
|
-
//expect(res.body.default).to.equal(false);
|
146
|
-
expect(res.body.lang).to.equal("EN");
|
147
|
-
done();
|
148
|
-
});
|
130
|
+
|
131
|
+
if (err) { console.error("err: ", err); }
|
132
|
+
if (log) { console.log("res.body", res.body); }
|
133
|
+
|
134
|
+
expect(res.body.data.LABEL_PLACEHOLDER).to.equal("type your message..");
|
135
|
+
//expect(res.body.default).to.equal(false);
|
136
|
+
expect(res.body.lang).to.equal("EN");
|
137
|
+
done();
|
149
138
|
});
|
150
|
-
|
151
|
-
|
152
|
-
});
|
153
139
|
});
|
154
|
-
|
140
|
+
});
|
155
141
|
});
|
142
|
+
});
|
143
|
+
|
156
144
|
|
145
|
+
it('cloneENAndGetByLanguageAR', (done) => {
|
157
146
|
|
147
|
+
var email = "test-signup-" + Date.now() + "@email.com";
|
148
|
+
var pwd = "pwd";
|
149
|
+
|
150
|
+
userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
|
151
|
+
projectService.create("test1", savedUser._id).then(function (savedProject) {
|
152
|
+
|
153
|
+
chai.request(server)
|
154
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
155
|
+
.auth(email, pwd)
|
156
|
+
.send({ lang: "EN" })
|
157
|
+
.end((err, res) => {
|
158
158
|
|
159
|
+
if (err) { console.error("err: ", err); }
|
160
|
+
if (log) { console.log("res.body", res.body); }
|
159
161
|
|
160
|
-
|
162
|
+
res.should.have.status(200);
|
163
|
+
res.body.should.be.a('object');
|
164
|
+
// expect(res.body.jwtSecret).to.not.equal(null);
|
165
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
166
|
+
expect(res.body.data[0].lang).to.equal("EN");
|
167
|
+
expect(res.body.data[0].default).to.equal(true);
|
161
168
|
|
162
|
-
|
163
|
-
// this.timeout();
|
164
|
-
|
165
|
-
var email = "test-signup-" + Date.now() + "@email.com";
|
166
|
-
var pwd = "pwd";
|
167
|
-
|
168
|
-
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
169
|
-
projectService.create("test1", savedUser._id).then(function(savedProject) {
|
170
|
-
|
171
169
|
chai.request(server)
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
.get('/'+ savedProject._id + '/labels/AR')
|
187
|
-
.auth(email, pwd)
|
188
|
-
.send()
|
189
|
-
.end((err, res) => {
|
190
|
-
//console.log("res", res);
|
191
|
-
console.log("res.body", res.body);
|
192
|
-
expect(res.body.data.LABEL_PLACEHOLDER).to.equal("type your message..");
|
193
|
-
//expect(res.body.default).to.equal(false);
|
194
|
-
expect(res.body.lang).to.equal("EN");
|
195
|
-
done();
|
196
|
-
});
|
197
|
-
});
|
198
|
-
|
199
|
-
|
200
|
-
});
|
201
|
-
});
|
202
|
-
|
170
|
+
.get('/' + savedProject._id + '/labels/AR')
|
171
|
+
.auth(email, pwd)
|
172
|
+
.send()
|
173
|
+
.end((err, res) => {
|
174
|
+
|
175
|
+
if (err) { console.error("err: ", err); }
|
176
|
+
if (log) { console.log("res.body", res.body); }
|
177
|
+
|
178
|
+
expect(res.body.data.LABEL_PLACEHOLDER).to.equal("type your message..");
|
179
|
+
//expect(res.body.default).to.equal(false);
|
180
|
+
expect(res.body.lang).to.equal("EN");
|
181
|
+
done();
|
182
|
+
});
|
183
|
+
});
|
203
184
|
});
|
185
|
+
});
|
186
|
+
});
|
204
187
|
|
205
188
|
|
189
|
+
it('cloneARAndGetByLanguageAR', (done) => {
|
206
190
|
|
191
|
+
var email = "test-signup-" + Date.now() + "@email.com";
|
192
|
+
var pwd = "pwd";
|
207
193
|
|
208
|
-
|
194
|
+
userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
|
195
|
+
projectService.create("test1", savedUser._id).then(function (savedProject) {
|
209
196
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
chai.request(server)
|
234
|
-
.get('/'+ savedProject._id + '/labels/ARR')
|
235
|
-
.auth(email, pwd)
|
236
|
-
.send()
|
237
|
-
.end((err, res) => {
|
238
|
-
//console.log("res", res);
|
239
|
-
console.log("res.body ar", res.body);
|
240
|
-
expect(res.body.data.LABEL_PLACEHOLDER).to.equal("type your message..");
|
241
|
-
expect(res.body.lang).to.equal("ARR");
|
242
|
-
expect(res.body.default).to.equal(true);
|
243
|
-
done();
|
244
|
-
});
|
245
|
-
});
|
246
|
-
|
247
|
-
|
248
|
-
});
|
249
|
-
});
|
250
|
-
|
251
|
-
});
|
197
|
+
chai.request(server)
|
198
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
199
|
+
.auth(email, pwd)
|
200
|
+
.send({ lang: "ARR" }) //not exists
|
201
|
+
.end((err, res) => {
|
202
|
+
|
203
|
+
if (err) { console.error("err: ", err); }
|
204
|
+
if (log) { console.log("res.body", res.body); }
|
205
|
+
|
206
|
+
res.should.have.status(200);
|
207
|
+
res.body.should.be.a('object');
|
208
|
+
// expect(res.body.jwtSecret).to.not.equal(null);
|
209
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
210
|
+
expect(res.body.data[0].lang).to.equal("ARR");
|
211
|
+
|
212
|
+
|
213
|
+
chai.request(server)
|
214
|
+
.get('/' + savedProject._id + '/labels/ARR')
|
215
|
+
.auth(email, pwd)
|
216
|
+
.send()
|
217
|
+
.end((err, res) => {
|
252
218
|
|
219
|
+
if (err) { console.error("err: ", err); }
|
220
|
+
if (log) { console.log("res.body ar", res.body); }
|
253
221
|
|
222
|
+
expect(res.body.data.LABEL_PLACEHOLDER).to.equal("type your message..");
|
223
|
+
expect(res.body.lang).to.equal("ARR");
|
224
|
+
expect(res.body.default).to.equal(true);
|
225
|
+
done();
|
226
|
+
});
|
227
|
+
});
|
228
|
+
});
|
229
|
+
});
|
230
|
+
});
|
254
231
|
|
255
232
|
|
256
233
|
// mocha test/labelRoute.js --grep 'cloneITAndgetByLanguageEN'
|
257
234
|
it('cloneITAndgetByLanguageEN', (done) => {
|
258
235
|
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
236
|
+
var email = "test-signup-" + Date.now() + "@email.com";
|
237
|
+
var pwd = "pwd";
|
238
|
+
|
239
|
+
userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
|
240
|
+
projectService.create("test1", savedUser._id).then(function (savedProject) {
|
241
|
+
|
242
|
+
chai.request(server)
|
243
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
244
|
+
.auth(email, pwd)
|
245
|
+
.send({ lang: "IT" })
|
246
|
+
.end((err, res) => {
|
247
|
+
|
248
|
+
if (err) { console.error("err: ", err); }
|
249
|
+
if (log) { console.log("res.body", res.body); }
|
250
|
+
|
251
|
+
res.should.have.status(200);
|
252
|
+
res.body.should.be.a('object');
|
253
|
+
// expect(res.body.jwtSecret).to.not.equal(null);
|
254
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
255
|
+
expect(res.body.data[0].default).to.equal(true);
|
256
|
+
expect(res.body.data[0].lang).to.equal("IT");
|
257
|
+
|
258
|
+
chai.request(server)
|
259
|
+
.get('/' + savedProject._id + '/labels/EN')
|
270
260
|
.auth(email, pwd)
|
271
|
-
.send(
|
261
|
+
.send()
|
272
262
|
.end((err, res) => {
|
273
|
-
|
274
|
-
console.
|
275
|
-
res.
|
276
|
-
|
277
|
-
|
278
|
-
expect(res.body.
|
279
|
-
expect(res.body.
|
280
|
-
|
281
|
-
|
282
|
-
chai.request(server)
|
283
|
-
.get('/'+ savedProject._id + '/labels/EN')
|
284
|
-
.auth(email, pwd)
|
285
|
-
.send()
|
286
|
-
.end((err, res) => {
|
287
|
-
//console.log("res", res);
|
288
|
-
console.log("res.body", res.body);
|
289
|
-
expect(res.body.data.LABEL_PLACEHOLDER).to.equal("Scrivi la tua domanda...");
|
290
|
-
expect(res.body.lang).to.equal("IT");
|
291
|
-
expect(res.body.default).to.equal(true);
|
292
|
-
done();
|
293
|
-
});
|
263
|
+
|
264
|
+
if (err) { console.error("err: ", err); }
|
265
|
+
if (log) { console.log("res.body", res.body); }
|
266
|
+
|
267
|
+
expect(res.body.data.LABEL_PLACEHOLDER).to.equal("Scrivi la tua domanda...");
|
268
|
+
expect(res.body.lang).to.equal("IT");
|
269
|
+
expect(res.body.default).to.equal(true);
|
270
|
+
done();
|
294
271
|
});
|
295
|
-
|
296
|
-
|
297
272
|
});
|
298
|
-
|
299
|
-
|
273
|
+
});
|
300
274
|
});
|
275
|
+
});
|
301
276
|
|
302
277
|
|
278
|
+
// mocha test/labelRoute.js --grep 'cloneITcloneENAndgetByLanguageEN'
|
279
|
+
it('cloneITcloneENAndgetByLanguageEN', (done) => {
|
303
280
|
|
281
|
+
var email = "test-signup-" + Date.now() + "@email.com";
|
282
|
+
var pwd = "pwd";
|
304
283
|
|
284
|
+
userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
|
285
|
+
projectService.create("test1", savedUser._id).then(function (savedProject) {
|
305
286
|
|
287
|
+
chai.request(server)
|
288
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
289
|
+
.auth(email, pwd)
|
290
|
+
.send({ lang: "IT" })
|
291
|
+
.end((err, res) => {
|
306
292
|
|
307
|
-
|
308
|
-
|
293
|
+
if (err) { console.error("err: ", err); }
|
294
|
+
if (log) { console.log("res.body", res.body); }
|
309
295
|
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
chai.request(server)
|
320
|
-
.post('/'+ savedProject._id + '/labels/default/clone')
|
296
|
+
res.should.have.status(200);
|
297
|
+
res.body.should.be.a('object');
|
298
|
+
// expect(res.body.jwtSecret).to.not.equal(null);
|
299
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
300
|
+
expect(res.body.data[0].default).to.equal(true);
|
301
|
+
expect(res.body.data[0].lang).to.equal("IT");
|
302
|
+
|
303
|
+
chai.request(server)
|
304
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
321
305
|
.auth(email, pwd)
|
322
|
-
.send({lang: "
|
306
|
+
.send({ lang: "EN" })
|
323
307
|
.end((err, res) => {
|
324
|
-
|
325
|
-
console.
|
308
|
+
|
309
|
+
if (err) { console.error("err: ", err); }
|
310
|
+
if (log) { console.log("res.body en", res.body); }
|
311
|
+
|
326
312
|
res.should.have.status(200);
|
327
313
|
res.body.should.be.a('object');
|
328
314
|
// expect(res.body.jwtSecret).to.not.equal(null);
|
329
|
-
expect(res.body.id_project).to.equal(savedProject.id);
|
330
|
-
expect(res.body.data[
|
331
|
-
expect(res.body.data[
|
332
|
-
|
333
|
-
|
334
|
-
.
|
315
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
316
|
+
expect(res.body.data[1].default).to.equal(false);
|
317
|
+
expect(res.body.data[1].lang).to.equal("EN");
|
318
|
+
|
319
|
+
chai.request(server)
|
320
|
+
.get('/' + savedProject._id + '/labels/EN')
|
335
321
|
.auth(email, pwd)
|
336
|
-
.send(
|
322
|
+
.send()
|
337
323
|
.end((err, res) => {
|
338
|
-
|
339
|
-
console.
|
340
|
-
res.
|
341
|
-
|
342
|
-
|
343
|
-
expect(res.body.
|
344
|
-
expect(res.body.
|
345
|
-
|
346
|
-
|
347
|
-
chai.request(server)
|
348
|
-
.get('/'+ savedProject._id + '/labels/EN')
|
349
|
-
.auth(email, pwd)
|
350
|
-
.send()
|
351
|
-
.end((err, res) => {
|
352
|
-
//console.log("res", res);
|
353
|
-
console.log("res.body", res.body);
|
354
|
-
expect(res.body.data.LABEL_PLACEHOLDER).to.equal("type your message..");
|
355
|
-
expect(res.body.lang).to.equal("EN");
|
356
|
-
expect(res.body.default).to.equal(false);
|
357
|
-
done();
|
358
|
-
});
|
324
|
+
|
325
|
+
if (err) { console.error("err: ", err); }
|
326
|
+
if (log) { console.log("res.body", res.body); }
|
327
|
+
|
328
|
+
expect(res.body.data.LABEL_PLACEHOLDER).to.equal("type your message..");
|
329
|
+
expect(res.body.lang).to.equal("EN");
|
330
|
+
expect(res.body.default).to.equal(false);
|
331
|
+
done();
|
359
332
|
});
|
360
|
-
|
361
|
-
|
362
333
|
});
|
363
|
-
|
364
|
-
|
365
|
-
});
|
366
334
|
});
|
367
|
-
|
335
|
+
});
|
368
336
|
});
|
337
|
+
});
|
369
338
|
|
370
339
|
|
340
|
+
// mocha test/labelRoute.js --grep 'cloneITAndgetByLanguageEN'
|
341
|
+
it('cloneITcloneENModifyENAndgetByLanguageEN', (done) => {
|
371
342
|
|
343
|
+
var email = "test-signup-" + Date.now() + "@email.com";
|
344
|
+
var pwd = "pwd";
|
372
345
|
|
346
|
+
userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
|
347
|
+
projectService.create("test1", savedUser._id).then(function (savedProject) {
|
373
348
|
|
349
|
+
chai.request(server)
|
350
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
351
|
+
.auth(email, pwd)
|
352
|
+
.send({ lang: "IT" })
|
353
|
+
.end((err, res) => {
|
374
354
|
|
375
|
-
|
376
|
-
|
355
|
+
if (err) { console.error("err: ", err); }
|
356
|
+
if (log) { console.log("res.body", res.body); }
|
377
357
|
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
chai.request(server)
|
388
|
-
.post('/'+ savedProject._id + '/labels/default/clone')
|
358
|
+
res.should.have.status(200);
|
359
|
+
res.body.should.be.a('object');
|
360
|
+
// expect(res.body.jwtSecret).to.not.equal(null);
|
361
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
362
|
+
|
363
|
+
|
364
|
+
chai.request(server)
|
365
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
389
366
|
.auth(email, pwd)
|
390
|
-
.send({lang: "
|
367
|
+
.send({ lang: "EN" })
|
391
368
|
.end((err, res) => {
|
392
|
-
|
393
|
-
console.
|
369
|
+
|
370
|
+
if (err) { console.error("err: ", err); }
|
371
|
+
if (log) { console.log("res.body", res.body); }
|
372
|
+
|
394
373
|
res.should.have.status(200);
|
395
374
|
res.body.should.be.a('object');
|
396
375
|
// expect(res.body.jwtSecret).to.not.equal(null);
|
397
|
-
expect(res.body.id_project).to.equal(savedProject.id);
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
376
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
var modifiedEN = { "lang": "EN", "data": { "LABEL_PLACEHOLDER": "type your message modified..", "LABEL_START_NW_CONV": "New conversation", "LABEL_FIRST_MSG": "Describe shortly your problem, you will be contacted by an agent.", "LABEL_FIRST_MSG_NO_AGENTS": "🤔 All operators are offline at the moment. You can anyway describe your problem. It will be assigned to the support team who will answer you as soon as possible.", "LABEL_FIRST_MSG_OPERATING_HOURS_CLOSED": "🤔 Our offices are closed. You can anyway describe your problem. It will be assigned to the support team who will answer you as soon as possible.", "LABEL_SELECT_TOPIC": "Select a topic", "LABEL_COMPLETE_FORM": "Complete the form to start a conversation with the next available agent.", "LABEL_FIELD_NAME": "Name", "LABEL_ERROR_FIELD_NAME": "Required field (minimum 5 characters).", "LABEL_FIELD_EMAIL": "Email", "LABEL_ERROR_FIELD_EMAIL": "Enter a valid email address.", "LABEL_WRITING": "is writing...", "AGENT_NOT_AVAILABLE": " Offline", "AGENT_AVAILABLE": " Online", "GUEST_LABEL": "Guest", "ALL_AGENTS_OFFLINE_LABEL": "All operators are offline at the moment", "LABEL_LOADING": "Loading...", "CALLOUT_TITLE_PLACEHOLDER": "Need Help?", "CALLOUT_MSG_PLACEHOLDER": "Click here and start chatting with us!", "CUSTOMER_SATISFACTION": "Customer satisfaction", "YOUR_OPINION_ON_OUR_CUSTOMER_SERVICE": "your opinion on our customer service", "DOWNLOAD_TRANSCRIPT": "Download transcript", "BACK": "Back", "YOUR_RATING": "your rating", "WRITE_YOUR_OPINION": "Write your opinion ... (optional)", "SUBMIT": "Submit", "THANK_YOU_FOR_YOUR_EVALUATION": "Thank you for your evaluation", "YOUR_RATING_HAS_BEEN_RECEIVED": "your rating has been received", "ALERT_LEAVE_CHAT": "Do you want to leave the chat?", "YES": "Yes", "NO": "No", "BUTTON_CLOSE_TO_ICON": "Minimize chat", "BUTTON_EDIT_PROFILE": "Update profile", "BUTTON_DOWNLOAD_TRANSCRIPT": "Download transcript", "RATE_CHAT": "Rate chat", "WELLCOME_TITLE": "Hi, welcome to Tiledesk 👋", "WELLCOME_MSG": "How can we help?", "WELLCOME": "Welcome", "OPTIONS": "options", "SOUND_OFF": "sound off", "SOUND_ON": "sound on", "LOGOUT": "logout", "CLOSE": "close", "PREV_CONVERSATIONS": "Your conversations", "YOU": "You", "SHOW_ALL_CONV": "show all", "START_A_CONVERSATION": "Start a conversation", "NO_CONVERSATION": "No conversation", "SEE_PREVIOUS": "see previous", "WAITING_TIME_FOUND": "The team typically replies in ", "WAITING_TIME_NOT_FOUND": "The team will reply as soon as possible", "CLOSED": "CLOSED" } };
|
381
|
+
|
382
|
+
chai.request(server)
|
383
|
+
.post('/' + savedProject._id + '/labels')
|
402
384
|
.auth(email, pwd)
|
403
|
-
.send(
|
385
|
+
.send(modifiedEN)
|
404
386
|
.end((err, res) => {
|
405
|
-
|
406
|
-
console.
|
387
|
+
|
388
|
+
if (err) { console.error("err: ", err); }
|
389
|
+
if (log) { console.log("res.body", res.body); }
|
390
|
+
|
407
391
|
res.should.have.status(200);
|
408
392
|
res.body.should.be.a('object');
|
409
393
|
// expect(res.body.jwtSecret).to.not.equal(null);
|
410
|
-
expect(res.body.id_project).to.equal(savedProject.id);
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
var modifiedEN = {"lang":"EN","data":{"LABEL_PLACEHOLDER":"type your message modified..","LABEL_START_NW_CONV":"New conversation","LABEL_FIRST_MSG":"Describe shortly your problem, you will be contacted by an agent.","LABEL_FIRST_MSG_NO_AGENTS":"🤔 All operators are offline at the moment. You can anyway describe your problem. It will be assigned to the support team who will answer you as soon as possible.","LABEL_FIRST_MSG_OPERATING_HOURS_CLOSED":"🤔 Our offices are closed. You can anyway describe your problem. It will be assigned to the support team who will answer you as soon as possible.","LABEL_SELECT_TOPIC":"Select a topic","LABEL_COMPLETE_FORM":"Complete the form to start a conversation with the next available agent.","LABEL_FIELD_NAME":"Name","LABEL_ERROR_FIELD_NAME":"Required field (minimum 5 characters).","LABEL_FIELD_EMAIL":"Email","LABEL_ERROR_FIELD_EMAIL":"Enter a valid email address.","LABEL_WRITING":"is writing...","AGENT_NOT_AVAILABLE":" Offline","AGENT_AVAILABLE":" Online","GUEST_LABEL":"Guest","ALL_AGENTS_OFFLINE_LABEL":"All operators are offline at the moment","LABEL_LOADING":"Loading...","CALLOUT_TITLE_PLACEHOLDER":"Need Help?","CALLOUT_MSG_PLACEHOLDER":"Click here and start chatting with us!","CUSTOMER_SATISFACTION":"Customer satisfaction","YOUR_OPINION_ON_OUR_CUSTOMER_SERVICE":"your opinion on our customer service","DOWNLOAD_TRANSCRIPT":"Download transcript","BACK":"Back","YOUR_RATING":"your rating","WRITE_YOUR_OPINION":"Write your opinion ... (optional)","SUBMIT":"Submit","THANK_YOU_FOR_YOUR_EVALUATION":"Thank you for your evaluation","YOUR_RATING_HAS_BEEN_RECEIVED":"your rating has been received","ALERT_LEAVE_CHAT":"Do you want to leave the chat?","YES":"Yes","NO":"No","BUTTON_CLOSE_TO_ICON":"Minimize chat","BUTTON_EDIT_PROFILE":"Update profile","BUTTON_DOWNLOAD_TRANSCRIPT":"Download transcript","RATE_CHAT":"Rate chat","WELLCOME_TITLE":"Hi, welcome to Tiledesk 👋","WELLCOME_MSG":"How can we help?","WELLCOME":"Welcome","OPTIONS":"options","SOUND_OFF":"sound off","SOUND_ON":"sound on","LOGOUT":"logout","CLOSE":"close","PREV_CONVERSATIONS":"Your conversations","YOU":"You","SHOW_ALL_CONV":"show all","START_A_CONVERSATION":"Start a conversation","NO_CONVERSATION":"No conversation","SEE_PREVIOUS":"see previous","WAITING_TIME_FOUND":"The team typically replies in ","WAITING_TIME_NOT_FOUND":"The team will reply as soon as possible","CLOSED":"CLOSED"}};
|
415
394
|
|
416
395
|
chai.request(server)
|
417
|
-
|
418
|
-
.auth(email, pwd)
|
419
|
-
.send(modifiedEN)
|
420
|
-
.end((err, res) => {
|
421
|
-
//console.log("res", res);
|
422
|
-
console.log("res.body", res.body);
|
423
|
-
res.should.have.status(200);
|
424
|
-
res.body.should.be.a('object');
|
425
|
-
// expect(res.body.jwtSecret).to.not.equal(null);
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
chai.request(server)
|
431
|
-
.get('/'+ savedProject._id + '/labels/EN')
|
396
|
+
.get('/' + savedProject._id + '/labels/EN')
|
432
397
|
.auth(email, pwd)
|
433
398
|
.send()
|
434
399
|
.end((err, res) => {
|
435
|
-
//console.log("res", res);
|
436
|
-
console.log("res.body", res.body);
|
437
|
-
expect(res.body.data.LABEL_PLACEHOLDER).to.equal("type your message modified..");
|
438
|
-
done();
|
439
|
-
});
|
440
|
-
});
|
441
|
-
|
442
|
-
|
443
400
|
|
401
|
+
if (err) { console.error("err: ", err); }
|
402
|
+
if (log) { console.log("res.body", res.body); }
|
444
403
|
|
404
|
+
expect(res.body.data.LABEL_PLACEHOLDER).to.equal("type your message modified..");
|
405
|
+
done();
|
406
|
+
});
|
445
407
|
});
|
446
|
-
|
447
|
-
|
448
408
|
});
|
449
|
-
|
450
|
-
|
451
|
-
});
|
452
409
|
});
|
453
|
-
|
410
|
+
});
|
454
411
|
});
|
412
|
+
});
|
455
413
|
|
456
414
|
|
415
|
+
// mocha test/labelRoute.js --grep 'cloneITAndgetByLanguageEN'
|
416
|
+
it('cloneITcloneENAndgetByLanguageFR', (done) => {
|
457
417
|
|
418
|
+
var email = "test-signup-" + Date.now() + "@email.com";
|
419
|
+
var pwd = "pwd";
|
458
420
|
|
421
|
+
userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
|
422
|
+
projectService.create("test1", savedUser._id).then(function (savedProject) {
|
459
423
|
|
424
|
+
chai.request(server)
|
425
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
426
|
+
.auth(email, pwd)
|
427
|
+
.send({ lang: "IT" })
|
428
|
+
.end((err, res) => {
|
460
429
|
|
430
|
+
if (err) { console.error("err: ", err); }
|
431
|
+
if (log) { console.log("res.body", res.body); }
|
461
432
|
|
462
|
-
|
463
|
-
|
433
|
+
res.should.have.status(200);
|
434
|
+
res.body.should.be.a('object');
|
435
|
+
// expect(res.body.jwtSecret).to.not.equal(null);
|
436
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
464
437
|
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
var email = "test-signup-" + Date.now() + "@email.com";
|
469
|
-
var pwd = "pwd";
|
470
|
-
|
471
|
-
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
472
|
-
projectService.create("test1", savedUser._id).then(function(savedProject) {
|
473
|
-
|
474
|
-
chai.request(server)
|
475
|
-
.post('/'+ savedProject._id + '/labels/default/clone')
|
438
|
+
|
439
|
+
chai.request(server)
|
440
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
476
441
|
.auth(email, pwd)
|
477
|
-
.send({lang: "
|
442
|
+
.send({ lang: "EN" })
|
478
443
|
.end((err, res) => {
|
479
|
-
|
480
|
-
console.
|
444
|
+
|
445
|
+
if (err) { console.error("err: ", err); }
|
446
|
+
if (log) { console.log("res.body", res.body); }
|
447
|
+
|
481
448
|
res.should.have.status(200);
|
482
449
|
res.body.should.be.a('object');
|
483
450
|
// expect(res.body.jwtSecret).to.not.equal(null);
|
484
|
-
expect(res.body.id_project).to.equal(savedProject.id);
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
.
|
451
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
452
|
+
|
453
|
+
|
454
|
+
chai.request(server)
|
455
|
+
.get('/' + savedProject._id + '/labels/FR')
|
489
456
|
.auth(email, pwd)
|
490
|
-
.send(
|
457
|
+
.send()
|
491
458
|
.end((err, res) => {
|
492
|
-
|
493
|
-
console.
|
494
|
-
res.
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
chai.request(server)
|
501
|
-
.get('/'+ savedProject._id + '/labels/FR')
|
502
|
-
.auth(email, pwd)
|
503
|
-
.send()
|
504
|
-
.end((err, res) => {
|
505
|
-
//console.log("res", res);
|
506
|
-
console.log("res.body", res.body);
|
507
|
-
expect(res.body.data.LABEL_PLACEHOLDER).to.equal("Scrivi la tua domanda...");
|
508
|
-
done();
|
509
|
-
});
|
459
|
+
|
460
|
+
if (err) { console.error("err: ", err); }
|
461
|
+
if (log) { console.log("res.body", res.body); }
|
462
|
+
|
463
|
+
expect(res.body.data.LABEL_PLACEHOLDER).to.equal("Scrivi la tua domanda...");
|
464
|
+
|
465
|
+
done();
|
510
466
|
});
|
511
|
-
|
512
|
-
|
513
467
|
});
|
514
|
-
|
515
|
-
|
516
468
|
});
|
517
|
-
|
518
|
-
|
469
|
+
});
|
519
470
|
});
|
520
|
-
|
521
|
-
});
|
522
|
-
|
523
|
-
|
471
|
+
});
|
472
|
+
});
|
524
473
|
|
525
474
|
|
526
|
-
describe('/update', () => {
|
527
|
-
|
528
|
-
|
529
|
-
// mocha test/labelRoute.js --grep 'update'
|
530
|
-
it('updateENforClonedEN', (done) => {
|
475
|
+
describe('/update', () => {
|
531
476
|
|
532
|
-
|
533
|
-
|
477
|
+
// mocha test/labelRoute.js --grep 'update'
|
478
|
+
it('updateENforClonedEN', (done) => {
|
534
479
|
|
535
|
-
|
536
|
-
|
480
|
+
var email = "test-signup-" + Date.now() + "@email.com";
|
481
|
+
var pwd = "pwd";
|
537
482
|
|
538
|
-
|
539
|
-
|
483
|
+
userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
|
484
|
+
projectService.create("test1", savedUser._id).then(function (savedProject) {
|
540
485
|
|
541
|
-
|
542
|
-
.post('/'+ savedProject._id + '/labels/default/clone')
|
486
|
+
chai.request(server)
|
487
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
543
488
|
.auth(email, pwd)
|
544
|
-
.send({lang: "EN"})
|
489
|
+
.send({ lang: "EN" })
|
545
490
|
.end((err, res) => {
|
546
|
-
|
547
|
-
console.
|
491
|
+
|
492
|
+
if (err) { console.error("err", err); }
|
493
|
+
if (log) { console.log("res.body", res.body); }
|
494
|
+
|
548
495
|
res.should.have.status(200);
|
549
496
|
res.body.should.be.a('object');
|
550
|
-
expect(res.body.id_project).to.equal(savedProject.id);
|
497
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
551
498
|
expect(res.body.data[0].default).to.equal(true);
|
552
|
-
expect(res.body.data[0].lang).to.equal("EN");
|
499
|
+
expect(res.body.data[0].lang).to.equal("EN");
|
553
500
|
|
554
501
|
|
555
502
|
chai.request(server)
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
console.log("err", err);
|
561
|
-
console.log("res.body", res.body);
|
562
|
-
res.should.have.status(200);
|
563
|
-
res.body.should.be.a('object');
|
564
|
-
expect(res.body.data.PIPPO).to.equal( "pippo");
|
565
|
-
expect(res.body.data.PLUTO).to.equal( "pluto");
|
566
|
-
expect(res.body.default).to.equal( true);
|
567
|
-
|
568
|
-
chai.request(server)
|
569
|
-
.get('/'+ savedProject._id + '/labels/')
|
570
|
-
.auth(email, pwd)
|
571
|
-
.send({})
|
572
|
-
.end((err, res) => {
|
573
|
-
console.log("err", err);
|
574
|
-
console.log("res.body", res.body);
|
575
|
-
res.should.have.status(200);
|
576
|
-
res.body.should.be.a('object');
|
577
|
-
expect(res.body.data[0].lang).to.equal("EN");
|
578
|
-
expect(res.body.data[0].default).to.equal(true);
|
579
|
-
|
580
|
-
done();
|
581
|
-
});
|
582
|
-
|
583
|
-
});
|
503
|
+
.post('/' + savedProject._id + '/labels/')
|
504
|
+
.auth(email, pwd)
|
505
|
+
.send({ lang: "EN", default: true, data: { PIPPO: "pippo", PLUTO: "pluto" } })
|
506
|
+
.end((err, res) => {
|
584
507
|
|
585
|
-
|
586
|
-
|
508
|
+
if (err) { console.error("err", err); }
|
509
|
+
if (log) { console.log("res.body", res.body); }
|
510
|
+
|
511
|
+
res.should.have.status(200);
|
512
|
+
res.body.should.be.a('object');
|
513
|
+
expect(res.body.data.PIPPO).to.equal("pippo");
|
514
|
+
expect(res.body.data.PLUTO).to.equal("pluto");
|
515
|
+
expect(res.body.default).to.equal(true);
|
516
|
+
|
517
|
+
chai.request(server)
|
518
|
+
.get('/' + savedProject._id + '/labels/')
|
519
|
+
.auth(email, pwd)
|
520
|
+
.send({})
|
521
|
+
.end((err, res) => {
|
522
|
+
|
523
|
+
if (err) { console.error("err", err); }
|
524
|
+
if (log) { console.log("res.body", res.body); }
|
525
|
+
|
526
|
+
res.should.have.status(200);
|
527
|
+
res.body.should.be.a('object');
|
528
|
+
expect(res.body.data[0].lang).to.equal("EN");
|
529
|
+
expect(res.body.data[0].default).to.equal(true);
|
530
|
+
|
531
|
+
done();
|
532
|
+
});
|
533
|
+
});
|
534
|
+
});
|
587
535
|
});
|
588
|
-
|
589
|
-
|
536
|
+
});
|
537
|
+
});
|
590
538
|
|
591
|
-
});
|
592
539
|
|
540
|
+
// mocha test/labelRoute.js --grep 'update'
|
541
|
+
it('updateARforClonedEN', (done) => {
|
593
542
|
|
543
|
+
var email = "test-signup-" + Date.now() + "@email.com";
|
544
|
+
var pwd = "pwd";
|
594
545
|
|
595
|
-
|
596
|
-
|
546
|
+
userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
|
547
|
+
projectService.create("test1", savedUser._id).then(function (savedProject) {
|
597
548
|
|
598
|
-
|
599
|
-
// this.timeout();
|
600
|
-
|
601
|
-
var email = "test-signup-" + Date.now() + "@email.com";
|
602
|
-
var pwd = "pwd";
|
603
|
-
|
604
|
-
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
605
|
-
projectService.create("test1", savedUser._id).then(function(savedProject) {
|
606
|
-
|
607
549
|
chai.request(server)
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
550
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
551
|
+
.auth(email, pwd)
|
552
|
+
.send({ lang: "EN" })
|
553
|
+
.end((err, res) => {
|
554
|
+
|
555
|
+
if (err) { console.error("err", err); }
|
556
|
+
if (log) { console.log("res.body", res.body); }
|
557
|
+
|
558
|
+
res.should.have.status(200);
|
559
|
+
res.body.should.be.a('object');
|
560
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
561
|
+
expect(res.body.data[0].default).to.equal(true);
|
562
|
+
expect(res.body.data[0].lang).to.equal("EN");
|
563
|
+
|
564
|
+
|
565
|
+
chai.request(server)
|
566
|
+
.post('/' + savedProject._id + '/labels/')
|
623
567
|
.auth(email, pwd)
|
624
|
-
.send({lang: "AR", default:true, data: {PIPPO: "pippo", PLUTO: "pluto"}})
|
568
|
+
.send({ lang: "AR", default: true, data: { PIPPO: "pippo", PLUTO: "pluto" } })
|
625
569
|
.end((err, res) => {
|
626
|
-
|
627
|
-
console.
|
570
|
+
|
571
|
+
if (err) { console.error("err", err); }
|
572
|
+
if (log) { console.log("res.body", res.body); }
|
573
|
+
|
628
574
|
res.should.have.status(200);
|
629
575
|
res.body.should.be.a('object');
|
630
|
-
expect(res.body.data.PIPPO).to.equal(
|
631
|
-
expect(res.body.data.PLUTO).to.equal(
|
632
|
-
expect(res.body.default).to.equal(
|
633
|
-
|
576
|
+
expect(res.body.data.PIPPO).to.equal("pippo");
|
577
|
+
expect(res.body.data.PLUTO).to.equal("pluto");
|
578
|
+
expect(res.body.default).to.equal(true);
|
579
|
+
|
634
580
|
chai.request(server)
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
});
|
656
|
-
|
581
|
+
.get('/' + savedProject._id + '/labels/')
|
582
|
+
.auth(email, pwd)
|
583
|
+
.send({})
|
584
|
+
.end((err, res) => {
|
585
|
+
|
586
|
+
if (err) { console.error("err", err); }
|
587
|
+
if (log) { console.log("res.body", res.body); }
|
588
|
+
|
589
|
+
res.should.have.status(200);
|
590
|
+
res.body.should.be.a('object');
|
591
|
+
expect(res.body.data[0].lang).to.equal("EN");
|
592
|
+
expect(res.body.data[0].default).to.equal(false);
|
593
|
+
expect(res.body.data[1].lang).to.equal("AR");
|
594
|
+
expect(res.body.data[1].default).to.equal(true);
|
595
|
+
done();
|
596
|
+
});
|
597
|
+
});
|
598
|
+
});
|
599
|
+
});
|
600
|
+
});
|
657
601
|
});
|
658
602
|
|
603
|
+
});
|
604
|
+
|
659
605
|
|
606
|
+
describe('/patch', () => {
|
660
607
|
|
608
|
+
// mocha test/labelRoute.js --grep 'patchdefaultENforClonedENanIT'
|
609
|
+
it('patchdefaultENforClonedENanIT', (done) => {
|
661
610
|
|
611
|
+
var email = "test-signup-" + Date.now() + "@email.com";
|
612
|
+
var pwd = "pwd";
|
662
613
|
|
663
|
-
|
664
|
-
|
614
|
+
userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
|
615
|
+
projectService.create("test1", savedUser._id).then(function (savedProject) {
|
665
616
|
|
666
|
-
|
617
|
+
chai.request(server)
|
618
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
619
|
+
.auth(email, pwd)
|
620
|
+
.send({ lang: "EN" })
|
621
|
+
.end((err, res) => {
|
622
|
+
if (err) { console.error("err", err); }
|
623
|
+
if (log) { console.log("res.body", res.body); }
|
624
|
+
res.should.have.status(200);
|
625
|
+
res.body.should.be.a('object');
|
626
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
627
|
+
expect(res.body.data[0].default).to.equal(true);
|
628
|
+
expect(res.body.data[0].lang).to.equal("EN");
|
667
629
|
|
668
630
|
|
631
|
+
chai.request(server)
|
632
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
633
|
+
.auth(email, pwd)
|
634
|
+
.send({ lang: "IT" })
|
635
|
+
.end((err, res) => {
|
636
|
+
if (err) { console.error("err", err); }
|
637
|
+
if (log) { console.log("res.body", res.body); }
|
638
|
+
res.should.have.status(200);
|
639
|
+
res.body.should.be.a('object');
|
640
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
641
|
+
expect(res.body.data[0].default).to.equal(true);
|
642
|
+
expect(res.body.data[0].lang).to.equal("EN");
|
643
|
+
expect(res.body.data[1].default).to.equal(false);
|
644
|
+
expect(res.body.data[1].lang).to.equal("IT");
|
645
|
+
|
646
|
+
|
647
|
+
chai.request(server)
|
648
|
+
.patch('/' + savedProject._id + '/labels/IT/default')
|
649
|
+
.auth(email, pwd)
|
650
|
+
.send({})
|
651
|
+
.end((err, res) => {
|
652
|
+
if (err) { console.error("err", err); }
|
653
|
+
if (log) { console.log("res.body", res.body); }
|
654
|
+
res.should.have.status(200);
|
655
|
+
res.body.should.be.a('object');
|
669
656
|
|
657
|
+
expect(res.body.default).to.equal(true);
|
658
|
+
done();
|
659
|
+
});
|
660
|
+
});
|
661
|
+
});
|
662
|
+
});
|
663
|
+
});
|
664
|
+
});
|
665
|
+
});
|
670
666
|
|
671
667
|
|
668
|
+
describe('/delete', () => {
|
672
669
|
|
673
670
|
|
671
|
+
// mocha test/labelRoute.js --grep 'deletedforClonedENanIT'
|
672
|
+
it('deletedforClonedENanIT', (done) => {
|
674
673
|
|
674
|
+
var email = "test-signup-" + Date.now() + "@email.com";
|
675
|
+
var pwd = "pwd";
|
675
676
|
|
677
|
+
userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
|
678
|
+
projectService.create("test1", savedUser._id).then(function (savedProject) {
|
676
679
|
|
677
|
-
describe('/patch', () => {
|
678
|
-
|
679
|
-
|
680
|
-
// mocha test/labelRoute.js --grep 'patchdefaultENforClonedENanIT'
|
681
|
-
it('patchdefaultENforClonedENanIT', (done) => {
|
682
|
-
|
683
|
-
|
684
|
-
// this.timeout();
|
685
|
-
|
686
|
-
var email = "test-signup-" + Date.now() + "@email.com";
|
687
|
-
var pwd = "pwd";
|
688
|
-
|
689
|
-
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
690
|
-
projectService.create("test1", savedUser._id).then(function(savedProject) {
|
691
|
-
|
692
680
|
chai.request(server)
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
.post('/'+ savedProject._id + '/labels/default/clone')
|
681
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
682
|
+
.auth(email, pwd)
|
683
|
+
.send({ lang: "EN" })
|
684
|
+
.end((err, res) => {
|
685
|
+
if (err) { console.error("err", err); }
|
686
|
+
if (log) { console.log("res.body", res.body); }
|
687
|
+
res.should.have.status(200);
|
688
|
+
res.body.should.be.a('object');
|
689
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
690
|
+
expect(res.body.data[0].default).to.equal(true);
|
691
|
+
expect(res.body.data[0].lang).to.equal("EN");
|
692
|
+
|
693
|
+
|
694
|
+
chai.request(server)
|
695
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
708
696
|
.auth(email, pwd)
|
709
|
-
.send({lang: "IT"})
|
697
|
+
.send({ lang: "IT" })
|
710
698
|
.end((err, res) => {
|
711
|
-
console.
|
712
|
-
console.log("res.body",
|
699
|
+
if (err) { console.error("err", err); }
|
700
|
+
if (log) { console.log("res.body", res.body); }
|
713
701
|
res.should.have.status(200);
|
714
702
|
res.body.should.be.a('object');
|
715
|
-
expect(res.body.id_project).to.equal(savedProject.id);
|
703
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
716
704
|
expect(res.body.data[0].default).to.equal(true);
|
717
|
-
expect(res.body.data[0].lang).to.equal("EN");
|
705
|
+
expect(res.body.data[0].lang).to.equal("EN");
|
718
706
|
expect(res.body.data[1].default).to.equal(false);
|
719
|
-
expect(res.body.data[1].lang).to.equal("IT");
|
720
|
-
|
721
|
-
|
707
|
+
expect(res.body.data[1].lang).to.equal("IT");
|
708
|
+
|
709
|
+
|
722
710
|
chai.request(server)
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
711
|
+
.delete('/' + savedProject._id + '/labels/')
|
712
|
+
.auth(email, pwd)
|
713
|
+
.send({})
|
714
|
+
.end((err, res) => {
|
715
|
+
if (err) { console.error("err", err); }
|
716
|
+
if (log) { console.log("res.body", res.body); }
|
717
|
+
res.should.have.status(200);
|
718
|
+
res.body.should.be.a('object');
|
719
|
+
expect(res.body.deletedCount).to.equal(1);
|
720
|
+
|
721
|
+
chai.request(server)
|
722
|
+
.get('/' + savedProject._id + '/labels/')
|
723
|
+
.auth(email, pwd)
|
724
|
+
.send({})
|
725
|
+
.end((err, res) => {
|
726
|
+
if (err) { console.error("err", err); }
|
727
|
+
if (log) { console.log("res.body", res.body); }
|
728
|
+
res.should.have.status(200);
|
729
|
+
expect(res.body).to.deep.equal({});
|
730
|
+
|
731
|
+
|
732
|
+
done();
|
733
|
+
});
|
734
|
+
});
|
735
735
|
});
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
});
|
740
|
-
});
|
741
|
-
|
742
|
-
});
|
743
|
-
|
736
|
+
});
|
737
|
+
});
|
738
|
+
});
|
744
739
|
});
|
745
740
|
|
746
|
-
});
|
747
741
|
|
742
|
+
// mocha test/labelRoute.js --grep 'deleteITforClonedENanIT'
|
743
|
+
it('deleteITforClonedENanIT', (done) => {
|
744
|
+
|
745
|
+
var email = "test-signup-" + Date.now() + "@email.com";
|
746
|
+
var pwd = "pwd";
|
748
747
|
|
748
|
+
userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
|
749
|
+
projectService.create("test1", savedUser._id).then(function (savedProject) {
|
749
750
|
|
750
|
-
describe('/delete', () => {
|
751
|
-
|
752
|
-
// mocha test/labelRoute.js --grep 'deletedforClonedENanIT'
|
753
|
-
it('deletedforClonedENanIT', (done) => {
|
754
|
-
|
755
|
-
|
756
|
-
// this.timeout();
|
757
|
-
|
758
|
-
var email = "test-signup-" + Date.now() + "@email.com";
|
759
|
-
var pwd = "pwd";
|
760
|
-
|
761
|
-
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
762
|
-
projectService.create("test1", savedUser._id).then(function(savedProject) {
|
763
|
-
|
764
751
|
chai.request(server)
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
.post('/'+ savedProject._id + '/labels/default/clone')
|
752
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
753
|
+
.auth(email, pwd)
|
754
|
+
.send({ lang: "EN" })
|
755
|
+
.end((err, res) => {
|
756
|
+
if (err) { console.error("err", err); }
|
757
|
+
if (log) { console.log("res.body", res.body); }
|
758
|
+
res.should.have.status(200);
|
759
|
+
res.body.should.be.a('object');
|
760
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
761
|
+
expect(res.body.data[0].default).to.equal(true);
|
762
|
+
expect(res.body.data[0].lang).to.equal("EN");
|
763
|
+
|
764
|
+
|
765
|
+
chai.request(server)
|
766
|
+
.post('/' + savedProject._id + '/labels/default/clone')
|
780
767
|
.auth(email, pwd)
|
781
|
-
.send({lang: "IT"})
|
768
|
+
.send({ lang: "IT" })
|
782
769
|
.end((err, res) => {
|
783
|
-
console.
|
784
|
-
console.log("res.body",
|
770
|
+
if (err) { console.error("err", err); }
|
771
|
+
if (log) { console.log("res.body", res.body); }
|
785
772
|
res.should.have.status(200);
|
786
773
|
res.body.should.be.a('object');
|
787
|
-
expect(res.body.id_project).to.equal(savedProject.id);
|
774
|
+
expect(res.body.id_project).to.equal(savedProject.id);
|
788
775
|
expect(res.body.data[0].default).to.equal(true);
|
789
|
-
expect(res.body.data[0].lang).to.equal("EN");
|
776
|
+
expect(res.body.data[0].lang).to.equal("EN");
|
790
777
|
expect(res.body.data[1].default).to.equal(false);
|
791
|
-
expect(res.body.data[1].lang).to.equal("IT");
|
792
|
-
|
793
|
-
|
778
|
+
expect(res.body.data[1].lang).to.equal("IT");
|
779
|
+
|
780
|
+
|
794
781
|
chai.request(server)
|
795
|
-
|
796
|
-
.auth(email, pwd)
|
797
|
-
.send({})
|
798
|
-
.end((err, res) => {
|
799
|
-
console.log("err", err);
|
800
|
-
console.log("res.body", res.body);
|
801
|
-
res.should.have.status(200);
|
802
|
-
res.body.should.be.a('object');
|
803
|
-
expect(res.body.deletedCount).to.equal(1);
|
804
|
-
|
805
|
-
chai.request(server)
|
806
|
-
.get('/'+ savedProject._id + '/labels/')
|
782
|
+
.delete('/' + savedProject._id + '/labels/IT')
|
807
783
|
.auth(email, pwd)
|
808
784
|
.send({})
|
809
785
|
.end((err, res) => {
|
810
|
-
console.
|
811
|
-
console.log("res.body",
|
786
|
+
if (err) { console.error("err", err); }
|
787
|
+
if (log) { console.log("res.body", res.body); }
|
812
788
|
res.should.have.status(200);
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
done();
|
817
|
-
|
818
|
-
});
|
819
|
-
|
820
|
-
|
821
|
-
});
|
822
|
-
});
|
823
|
-
|
824
|
-
|
825
|
-
});
|
826
|
-
});
|
827
|
-
|
828
|
-
});
|
829
|
-
|
830
|
-
});
|
831
|
-
|
832
|
-
|
789
|
+
res.body.should.be.a('object');
|
790
|
+
expect(res.body.lang).to.equal("EN");
|
833
791
|
|
792
|
+
chai.request(server)
|
793
|
+
.get('/' + savedProject._id + '/labels/')
|
794
|
+
.auth(email, pwd)
|
795
|
+
.send({})
|
796
|
+
.end((err, res) => {
|
797
|
+
if (err) { console.error("err", err); }
|
798
|
+
if (log) { console.log("res.body", res.body); }
|
834
799
|
|
800
|
+
res.should.have.status(200);
|
801
|
+
res.body.should.be.a('object');
|
802
|
+
expect(res.body.data[0].lang).to.equal("EN");
|
835
803
|
|
836
804
|
|
805
|
+
done();
|
837
806
|
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
var pwd = "pwd";
|
845
|
-
|
846
|
-
userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
|
847
|
-
projectService.create("test1", savedUser._id).then(function(savedProject) {
|
848
|
-
|
849
|
-
chai.request(server)
|
850
|
-
.post('/'+ savedProject._id + '/labels/default/clone')
|
851
|
-
.auth(email, pwd)
|
852
|
-
.send({lang: "EN"})
|
853
|
-
.end((err, res) => {
|
854
|
-
console.log("err", err);
|
855
|
-
console.log("res.body", res.body);
|
856
|
-
res.should.have.status(200);
|
857
|
-
res.body.should.be.a('object');
|
858
|
-
expect(res.body.id_project).to.equal(savedProject.id);
|
859
|
-
expect(res.body.data[0].default).to.equal(true);
|
860
|
-
expect(res.body.data[0].lang).to.equal("EN");
|
861
|
-
|
862
|
-
|
863
|
-
chai.request(server)
|
864
|
-
.post('/'+ savedProject._id + '/labels/default/clone')
|
865
|
-
.auth(email, pwd)
|
866
|
-
.send({lang: "IT"})
|
867
|
-
.end((err, res) => {
|
868
|
-
console.log("err", err);
|
869
|
-
console.log("res.body", res.body);
|
870
|
-
res.should.have.status(200);
|
871
|
-
res.body.should.be.a('object');
|
872
|
-
expect(res.body.id_project).to.equal(savedProject.id);
|
873
|
-
expect(res.body.data[0].default).to.equal(true);
|
874
|
-
expect(res.body.data[0].lang).to.equal("EN");
|
875
|
-
expect(res.body.data[1].default).to.equal(false);
|
876
|
-
expect(res.body.data[1].lang).to.equal("IT");
|
877
|
-
|
878
|
-
|
879
|
-
chai.request(server)
|
880
|
-
.delete('/'+ savedProject._id + '/labels/IT')
|
881
|
-
.auth(email, pwd)
|
882
|
-
.send({})
|
883
|
-
.end((err, res) => {
|
884
|
-
console.log("err", err);
|
885
|
-
console.log("res.body", res.body);
|
886
|
-
res.should.have.status(200);
|
887
|
-
res.body.should.be.a('object');
|
888
|
-
expect(res.body.lang).to.equal("EN");
|
889
|
-
|
890
|
-
chai.request(server)
|
891
|
-
.get('/'+ savedProject._id + '/labels/')
|
892
|
-
.auth(email, pwd)
|
893
|
-
.send({})
|
894
|
-
.end((err, res) => {
|
895
|
-
console.log("err", err);
|
896
|
-
console.log("res.body", res.body);
|
897
|
-
|
898
|
-
res.should.have.status(200);
|
899
|
-
res.body.should.be.a('object');
|
900
|
-
expect(res.body.data[0].lang).to.equal("EN");
|
901
|
-
|
902
|
-
|
903
|
-
done();
|
904
|
-
|
905
|
-
});
|
906
|
-
|
907
|
-
|
908
|
-
});
|
909
|
-
});
|
910
|
-
|
911
|
-
|
912
|
-
});
|
913
|
-
});
|
914
|
-
|
807
|
+
});
|
808
|
+
});
|
809
|
+
});
|
810
|
+
});
|
811
|
+
});
|
812
|
+
});
|
915
813
|
});
|
916
|
-
|
917
|
-
});
|
918
|
-
|
919
814
|
});
|
920
815
|
|
921
816
|
|