@takaro/modules 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dto/takaroEvents.js +3 -3
- package/dist/dto/takaroEvents.js.map +1 -1
- package/dist/modules/geoBlock/hooks/IPDetected.js +10 -10
- package/dist/modules/geoBlock/hooks/IPDetected.js.map +1 -1
- package/dist/modules/gimme/commands/gimme.js +1 -0
- package/dist/modules/gimme/commands/gimme.js.map +1 -1
- package/dist/modules.json +2 -2
- package/package.json +1 -1
- package/src/__tests__/aliases.integration.test.ts +5 -5
- package/src/__tests__/bugRepros.integration.test.ts +3 -3
- package/src/__tests__/commandArgs.integration.test.ts +23 -23
- package/src/__tests__/economyUtils.integration.test.ts +29 -22
- package/src/__tests__/geoblock.integration.test.ts +13 -55
- package/src/__tests__/gimme.integration.test.ts +33 -33
- package/src/__tests__/help.integration.test.ts +36 -23
- package/src/__tests__/lottery.integration.test.ts +27 -22
- package/src/__tests__/modulePermission.integration.test.ts +20 -13
- package/src/__tests__/onboarding.integration.test.ts +9 -9
- package/src/__tests__/ping.integration.test.ts +4 -4
- package/src/__tests__/roleExpiry.integration.test.ts +7 -7
- package/src/__tests__/serverMessages.integration.test.ts +10 -7
- package/src/__tests__/systemConfigCost.integration.test.ts +9 -9
- package/src/__tests__/teleports/listtp.integration.test.ts +30 -28
- package/src/__tests__/teleports/publicteleports.integration.test.ts +45 -37
- package/src/__tests__/teleports/teleport.integration.test.ts +14 -12
- package/src/__tests__/teleports/tpManagement.integration.test.ts +17 -17
- package/src/__tests__/teleports/waypoints.integration.test.ts +109 -77
- package/src/dto/takaroEvents.ts +3 -3
- package/src/modules/geoBlock/hooks/IPDetected.js +9 -9
- package/src/modules/gimme/commands/gimme.js +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
|
|
1
|
+
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
|
|
2
2
|
import { GameEvents } from '../../dto/index.js';
|
|
3
3
|
|
|
4
4
|
const group = 'Teleports suite';
|
|
@@ -20,7 +20,7 @@ const tests = [
|
|
|
20
20
|
},
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
const setTpEvent = this.
|
|
23
|
+
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
24
24
|
|
|
25
25
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
26
26
|
msg: '/settp test',
|
|
@@ -28,9 +28,9 @@ const tests = [
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
expect((await setTpEvent).length).to.be.eq(1);
|
|
31
|
-
expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
|
|
31
|
+
expect((await setTpEvent)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
32
32
|
|
|
33
|
-
const setPublicEvent = this.
|
|
33
|
+
const setPublicEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
34
34
|
|
|
35
35
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
36
36
|
msg: '/setpublic test',
|
|
@@ -38,16 +38,16 @@ const tests = [
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
expect((await setPublicEvent).length).to.be.eq(1);
|
|
41
|
-
expect((await setPublicEvent)[0].data.msg).to.be.eq('Teleport test is now public.');
|
|
41
|
+
expect((await setPublicEvent)[0].data.meta.msg).to.be.eq('Teleport test is now public.');
|
|
42
42
|
|
|
43
|
-
const tpEvent = this.
|
|
43
|
+
const tpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
44
44
|
|
|
45
45
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
46
46
|
msg: '/tp test',
|
|
47
47
|
playerId: this.setupData.players[1].id,
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
expect((await tpEvent)[0].data.msg).to.be.eq('Teleported to test.');
|
|
50
|
+
expect((await tpEvent)[0].data.meta.msg).to.be.eq('Teleported to test.');
|
|
51
51
|
},
|
|
52
52
|
}),
|
|
53
53
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -66,7 +66,7 @@ const tests = [
|
|
|
66
66
|
},
|
|
67
67
|
);
|
|
68
68
|
|
|
69
|
-
const setTpEvent = this.
|
|
69
|
+
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
70
70
|
|
|
71
71
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
72
72
|
msg: '/settp test',
|
|
@@ -74,9 +74,9 @@ const tests = [
|
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
expect((await setTpEvent).length).to.be.eq(1);
|
|
77
|
-
expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
|
|
77
|
+
expect((await setTpEvent)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
78
78
|
|
|
79
|
-
const setPublicEvent = this.
|
|
79
|
+
const setPublicEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
80
80
|
|
|
81
81
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
82
82
|
msg: '/setpublic test',
|
|
@@ -84,9 +84,12 @@ const tests = [
|
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
expect((await setPublicEvent).length).to.be.eq(1);
|
|
87
|
-
expect((await setPublicEvent)[0].data.msg).to.be.eq('Teleport test is now public.');
|
|
87
|
+
expect((await setPublicEvent)[0].data.meta.msg).to.be.eq('Teleport test is now public.');
|
|
88
88
|
|
|
89
|
-
const setPrivateEvent = this.
|
|
89
|
+
const setPrivateEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(
|
|
90
|
+
GameEvents.CHAT_MESSAGE,
|
|
91
|
+
1,
|
|
92
|
+
);
|
|
90
93
|
|
|
91
94
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
92
95
|
msg: '/setprivate test',
|
|
@@ -94,16 +97,16 @@ const tests = [
|
|
|
94
97
|
});
|
|
95
98
|
|
|
96
99
|
expect((await setPrivateEvent).length).to.be.eq(1);
|
|
97
|
-
expect((await setPrivateEvent)[0].data.msg).to.be.eq('Teleport test is now private.');
|
|
100
|
+
expect((await setPrivateEvent)[0].data.meta.msg).to.be.eq('Teleport test is now private.');
|
|
98
101
|
|
|
99
|
-
const tpEvent = this.
|
|
102
|
+
const tpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
100
103
|
|
|
101
104
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
102
105
|
msg: '/tp test',
|
|
103
106
|
playerId: this.setupData.players[1].id,
|
|
104
107
|
});
|
|
105
108
|
|
|
106
|
-
expect((await tpEvent)[0].data.msg).to.be.eq('Teleport test does not exist.');
|
|
109
|
+
expect((await tpEvent)[0].data.meta.msg).to.be.eq('Teleport test does not exist.');
|
|
107
110
|
},
|
|
108
111
|
}),
|
|
109
112
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -123,7 +126,7 @@ const tests = [
|
|
|
123
126
|
},
|
|
124
127
|
);
|
|
125
128
|
|
|
126
|
-
const setTpEvent = this.
|
|
129
|
+
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
127
130
|
|
|
128
131
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
129
132
|
msg: '/settp test',
|
|
@@ -131,9 +134,9 @@ const tests = [
|
|
|
131
134
|
});
|
|
132
135
|
|
|
133
136
|
expect((await setTpEvent).length).to.be.eq(1);
|
|
134
|
-
expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
|
|
137
|
+
expect((await setTpEvent)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
135
138
|
|
|
136
|
-
const setPublicEvent = this.
|
|
139
|
+
const setPublicEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
137
140
|
|
|
138
141
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
139
142
|
msg: '/setpublic test',
|
|
@@ -141,7 +144,7 @@ const tests = [
|
|
|
141
144
|
});
|
|
142
145
|
|
|
143
146
|
expect((await setPublicEvent).length).to.be.eq(1);
|
|
144
|
-
expect((await setPublicEvent)[0].data.msg).to.be.eq('Public teleports are disabled.');
|
|
147
|
+
expect((await setPublicEvent)[0].data.meta.msg).to.be.eq('Public teleports are disabled.');
|
|
145
148
|
},
|
|
146
149
|
}),
|
|
147
150
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -161,7 +164,7 @@ const tests = [
|
|
|
161
164
|
},
|
|
162
165
|
);
|
|
163
166
|
|
|
164
|
-
const setTpEvent = this.
|
|
167
|
+
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
165
168
|
|
|
166
169
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
167
170
|
msg: '/settp test',
|
|
@@ -169,9 +172,9 @@ const tests = [
|
|
|
169
172
|
});
|
|
170
173
|
|
|
171
174
|
expect((await setTpEvent).length).to.be.eq(1);
|
|
172
|
-
expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
|
|
175
|
+
expect((await setTpEvent)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
173
176
|
|
|
174
|
-
const setPublicEvent = this.
|
|
177
|
+
const setPublicEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
175
178
|
|
|
176
179
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
177
180
|
msg: '/setpublic test',
|
|
@@ -179,9 +182,9 @@ const tests = [
|
|
|
179
182
|
});
|
|
180
183
|
|
|
181
184
|
expect((await setPublicEvent).length).to.be.eq(1);
|
|
182
|
-
expect((await setPublicEvent)[0].data.msg).to.be.eq('Teleport test is now public.');
|
|
185
|
+
expect((await setPublicEvent)[0].data.meta.msg).to.be.eq('Teleport test is now public.');
|
|
183
186
|
|
|
184
|
-
const tpEvent = this.
|
|
187
|
+
const tpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
185
188
|
|
|
186
189
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
187
190
|
msg: '/tp test',
|
|
@@ -189,7 +192,7 @@ const tests = [
|
|
|
189
192
|
});
|
|
190
193
|
|
|
191
194
|
expect((await tpEvent).length).to.be.eq(1);
|
|
192
|
-
expect((await tpEvent)[0].data.msg).to.be.eq('Teleported to test.');
|
|
195
|
+
expect((await tpEvent)[0].data.meta.msg).to.be.eq('Teleported to test.');
|
|
193
196
|
|
|
194
197
|
await this.client.gameserver.gameServerControllerInstallModule(
|
|
195
198
|
this.setupData.gameserver.id,
|
|
@@ -202,7 +205,7 @@ const tests = [
|
|
|
202
205
|
},
|
|
203
206
|
);
|
|
204
207
|
|
|
205
|
-
const tpEvent2 = this.
|
|
208
|
+
const tpEvent2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
206
209
|
|
|
207
210
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
208
211
|
msg: '/tp test',
|
|
@@ -210,7 +213,7 @@ const tests = [
|
|
|
210
213
|
});
|
|
211
214
|
|
|
212
215
|
expect((await tpEvent2).length).to.be.eq(1);
|
|
213
|
-
expect((await tpEvent2)[0].data.msg).to.be.eq('Teleport test does not exist.');
|
|
216
|
+
expect((await tpEvent2)[0].data.meta.msg).to.be.eq('Teleport test does not exist.');
|
|
214
217
|
},
|
|
215
218
|
}),
|
|
216
219
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -240,7 +243,7 @@ const tests = [
|
|
|
240
243
|
},
|
|
241
244
|
);
|
|
242
245
|
|
|
243
|
-
const setTpEvent = this.
|
|
246
|
+
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
244
247
|
|
|
245
248
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
246
249
|
msg: '/settp test',
|
|
@@ -248,9 +251,9 @@ const tests = [
|
|
|
248
251
|
});
|
|
249
252
|
|
|
250
253
|
expect((await setTpEvent).length).to.be.eq(1);
|
|
251
|
-
expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
|
|
254
|
+
expect((await setTpEvent)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
252
255
|
|
|
253
|
-
const setPublicEvent = this.
|
|
256
|
+
const setPublicEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
254
257
|
|
|
255
258
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
256
259
|
msg: '/setpublic test',
|
|
@@ -258,7 +261,9 @@ const tests = [
|
|
|
258
261
|
});
|
|
259
262
|
|
|
260
263
|
expect((await setPublicEvent).length).to.be.eq(1);
|
|
261
|
-
expect((await setPublicEvent)[0].data.msg).to.be.eq(
|
|
264
|
+
expect((await setPublicEvent)[0].data.meta.msg).to.be.eq(
|
|
265
|
+
'You do not have permission to create public teleports.',
|
|
266
|
+
);
|
|
262
267
|
},
|
|
263
268
|
}),
|
|
264
269
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -292,7 +297,7 @@ const tests = [
|
|
|
292
297
|
},
|
|
293
298
|
);
|
|
294
299
|
|
|
295
|
-
const setTpEvent = this.
|
|
300
|
+
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 4);
|
|
296
301
|
|
|
297
302
|
await Promise.all(
|
|
298
303
|
Array.from({ length: 4 }).map(async (_, i) => {
|
|
@@ -306,10 +311,10 @@ const tests = [
|
|
|
306
311
|
expect((await setTpEvent).length).to.be.eq(4);
|
|
307
312
|
|
|
308
313
|
for (const event of await setTpEvent) {
|
|
309
|
-
expect(event.data.msg).to.match(/Teleport test\d set\./);
|
|
314
|
+
expect(event.data.meta.msg).to.match(/Teleport test\d set\./);
|
|
310
315
|
}
|
|
311
316
|
|
|
312
|
-
const setPublicEvent = this.
|
|
317
|
+
const setPublicEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 3);
|
|
313
318
|
|
|
314
319
|
await Promise.all(
|
|
315
320
|
Array.from({ length: 3 }).map(async (_, i) => {
|
|
@@ -323,10 +328,13 @@ const tests = [
|
|
|
323
328
|
expect((await setPublicEvent).length).to.be.eq(3);
|
|
324
329
|
|
|
325
330
|
for (const event of await setPublicEvent) {
|
|
326
|
-
expect(event.data.msg).to.match(/Teleport test\d is now public\./);
|
|
331
|
+
expect(event.data.meta.msg).to.match(/Teleport test\d is now public\./);
|
|
327
332
|
}
|
|
328
333
|
|
|
329
|
-
const setPublicEvent2 = this.
|
|
334
|
+
const setPublicEvent2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(
|
|
335
|
+
GameEvents.CHAT_MESSAGE,
|
|
336
|
+
1,
|
|
337
|
+
);
|
|
330
338
|
|
|
331
339
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
332
340
|
msg: '/setpublic test4',
|
|
@@ -335,7 +343,7 @@ const tests = [
|
|
|
335
343
|
|
|
336
344
|
expect((await setPublicEvent2).length).to.be.eq(1);
|
|
337
345
|
|
|
338
|
-
expect((await setPublicEvent2)[0].data.msg).to.be.eq(
|
|
346
|
+
expect((await setPublicEvent2)[0].data.meta.msg).to.be.eq(
|
|
339
347
|
'You have reached the maximum number of public teleports for your role, maximum allowed is 3',
|
|
340
348
|
);
|
|
341
349
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
|
|
1
|
+
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
|
|
2
2
|
import { GameEvents } from '../../dto/index.js';
|
|
3
3
|
|
|
4
4
|
const group = 'Teleports suite';
|
|
@@ -15,23 +15,23 @@ const tests = [
|
|
|
15
15
|
this.setupData.teleportsModule.id,
|
|
16
16
|
);
|
|
17
17
|
|
|
18
|
-
const setEvents = this.
|
|
18
|
+
const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
19
19
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
20
20
|
msg: '/settp test',
|
|
21
21
|
playerId: this.setupData.players[0].id,
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
expect((await setEvents).length).to.be.eq(1);
|
|
25
|
-
expect((await setEvents)[0].data.msg).to.be.eq('Teleport test set.');
|
|
25
|
+
expect((await setEvents)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
26
26
|
|
|
27
|
-
const events = this.
|
|
27
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
28
28
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
29
29
|
msg: '/tp test',
|
|
30
30
|
playerId: this.setupData.players[0].id,
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
expect((await events).length).to.be.eq(1);
|
|
34
|
-
expect((await events)[0].data.msg).to.be.eq('Teleported to test.');
|
|
34
|
+
expect((await events)[0].data.meta.msg).to.be.eq('Teleported to test.');
|
|
35
35
|
},
|
|
36
36
|
}),
|
|
37
37
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -44,7 +44,7 @@ const tests = [
|
|
|
44
44
|
this.setupData.gameserver.id,
|
|
45
45
|
this.setupData.teleportsModule.id,
|
|
46
46
|
);
|
|
47
|
-
const events = this.
|
|
47
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
48
48
|
|
|
49
49
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
50
50
|
msg: '/tp test',
|
|
@@ -52,7 +52,7 @@ const tests = [
|
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
expect((await events).length).to.be.eq(1);
|
|
55
|
-
expect((await events)[0].data.msg).to.be.eq('Teleport test does not exist.');
|
|
55
|
+
expect((await events)[0].data.meta.msg).to.be.eq('Teleport test does not exist.');
|
|
56
56
|
},
|
|
57
57
|
}),
|
|
58
58
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -71,7 +71,7 @@ const tests = [
|
|
|
71
71
|
},
|
|
72
72
|
);
|
|
73
73
|
|
|
74
|
-
const setTpEvent = this.
|
|
74
|
+
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
75
75
|
|
|
76
76
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
77
77
|
msg: '/settp test',
|
|
@@ -80,23 +80,25 @@ const tests = [
|
|
|
80
80
|
|
|
81
81
|
expect((await setTpEvent).length).to.be.eq(1);
|
|
82
82
|
|
|
83
|
-
const tpEvent = this.
|
|
83
|
+
const tpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
84
84
|
|
|
85
85
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
86
86
|
msg: '/tp test',
|
|
87
87
|
playerId: this.setupData.players[0].id,
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
-
expect((await tpEvent)[0].data.msg).to.be.eq('Teleported to test.');
|
|
90
|
+
expect((await tpEvent)[0].data.meta.msg).to.be.eq('Teleported to test.');
|
|
91
91
|
|
|
92
|
-
const tpTimeoutEvent = this.
|
|
92
|
+
const tpTimeoutEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
93
93
|
|
|
94
94
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
95
95
|
msg: '/tp test',
|
|
96
96
|
playerId: this.setupData.players[0].id,
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
-
expect((await tpTimeoutEvent)[0].data.msg).to.be.eq(
|
|
99
|
+
expect((await tpTimeoutEvent)[0].data.meta.msg).to.be.eq(
|
|
100
|
+
'You cannot teleport yet. Please wait before trying again.',
|
|
101
|
+
);
|
|
100
102
|
},
|
|
101
103
|
}),
|
|
102
104
|
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
|
|
1
|
+
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
|
|
2
2
|
import { GameEvents } from '../../dto/index.js';
|
|
3
3
|
|
|
4
4
|
const group = 'Teleports suite';
|
|
@@ -14,7 +14,7 @@ const tests = [
|
|
|
14
14
|
this.setupData.gameserver.id,
|
|
15
15
|
this.setupData.teleportsModule.id,
|
|
16
16
|
);
|
|
17
|
-
const events = this.
|
|
17
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
18
18
|
|
|
19
19
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
20
20
|
msg: '/settp test',
|
|
@@ -22,7 +22,7 @@ const tests = [
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
expect((await events).length).to.be.eq(1);
|
|
25
|
-
expect((await events)[0].data.msg).to.be.eq('Teleport test set.');
|
|
25
|
+
expect((await events)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
26
26
|
},
|
|
27
27
|
}),
|
|
28
28
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -36,7 +36,7 @@ const tests = [
|
|
|
36
36
|
this.setupData.teleportsModule.id,
|
|
37
37
|
);
|
|
38
38
|
|
|
39
|
-
const firstEvents = this.
|
|
39
|
+
const firstEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
40
40
|
|
|
41
41
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
42
42
|
msg: '/settp test',
|
|
@@ -44,9 +44,9 @@ const tests = [
|
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
expect((await firstEvents).length).to.be.eq(1);
|
|
47
|
-
expect((await firstEvents)[0].data.msg).to.be.eq('Teleport test set.');
|
|
47
|
+
expect((await firstEvents)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
48
48
|
|
|
49
|
-
const secondEvents = this.
|
|
49
|
+
const secondEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
50
50
|
|
|
51
51
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
52
52
|
msg: '/settp test',
|
|
@@ -54,7 +54,7 @@ const tests = [
|
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
expect((await secondEvents).length).to.be.eq(1);
|
|
57
|
-
expect((await secondEvents)[0].data.msg).to.be.eq(
|
|
57
|
+
expect((await secondEvents)[0].data.meta.msg).to.be.eq(
|
|
58
58
|
'Teleport test already exists, use /deletetp test to delete it.',
|
|
59
59
|
);
|
|
60
60
|
},
|
|
@@ -80,7 +80,7 @@ const tests = [
|
|
|
80
80
|
],
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
const setEvents = this.
|
|
83
|
+
const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 3);
|
|
84
84
|
|
|
85
85
|
await Promise.all(
|
|
86
86
|
Array.from({ length: 3 }).map(async (_, i) => {
|
|
@@ -94,9 +94,9 @@ const tests = [
|
|
|
94
94
|
expect((await setEvents).length).to.be.eq(3);
|
|
95
95
|
|
|
96
96
|
for (const event of await setEvents) {
|
|
97
|
-
expect(event.data.msg).to.match(/Teleport test\d set\./);
|
|
97
|
+
expect(event.data.meta.msg).to.match(/Teleport test\d set\./);
|
|
98
98
|
}
|
|
99
|
-
const events = this.
|
|
99
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
100
100
|
|
|
101
101
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
102
102
|
msg: '/settp test',
|
|
@@ -104,7 +104,7 @@ const tests = [
|
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
expect((await events).length).to.be.eq(1);
|
|
107
|
-
expect((await events)[0].data.msg).to.be.eq(
|
|
107
|
+
expect((await events)[0].data.meta.msg).to.be.eq(
|
|
108
108
|
'You have reached the maximum number of teleports for your role, maximum allowed is 3',
|
|
109
109
|
);
|
|
110
110
|
},
|
|
@@ -119,7 +119,7 @@ const tests = [
|
|
|
119
119
|
this.setupData.gameserver.id,
|
|
120
120
|
this.setupData.teleportsModule.id,
|
|
121
121
|
);
|
|
122
|
-
const setEvents = this.
|
|
122
|
+
const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 3);
|
|
123
123
|
|
|
124
124
|
await Promise.all(
|
|
125
125
|
Array.from({ length: 3 }).map(async (_, i) => {
|
|
@@ -133,16 +133,16 @@ const tests = [
|
|
|
133
133
|
expect((await setEvents).length).to.be.eq(3);
|
|
134
134
|
|
|
135
135
|
for (const event of await setEvents) {
|
|
136
|
-
expect(event.data.msg).to.match(/Teleport test\d set\./);
|
|
136
|
+
expect(event.data.meta.msg).to.match(/Teleport test\d set\./);
|
|
137
137
|
}
|
|
138
|
-
const events = this.
|
|
138
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
139
139
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
140
140
|
msg: '/deletetp test1',
|
|
141
141
|
playerId: this.setupData.players[0].id,
|
|
142
142
|
});
|
|
143
143
|
|
|
144
144
|
expect((await events).length).to.be.eq(1);
|
|
145
|
-
expect((await events)[0].data.msg).to.be.eq('Teleport test1 deleted.');
|
|
145
|
+
expect((await events)[0].data.meta.msg).to.be.eq('Teleport test1 deleted.');
|
|
146
146
|
},
|
|
147
147
|
}),
|
|
148
148
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -155,14 +155,14 @@ const tests = [
|
|
|
155
155
|
this.setupData.gameserver.id,
|
|
156
156
|
this.setupData.teleportsModule.id,
|
|
157
157
|
);
|
|
158
|
-
const events = this.
|
|
158
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
159
159
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
160
160
|
msg: '/deletetp test',
|
|
161
161
|
playerId: this.setupData.players[0].id,
|
|
162
162
|
});
|
|
163
163
|
|
|
164
164
|
expect((await events).length).to.be.eq(1);
|
|
165
|
-
expect((await events)[0].data.msg).to.be.eq('Teleport test does not exist.');
|
|
165
|
+
expect((await events)[0].data.meta.msg).to.be.eq('Teleport test does not exist.');
|
|
166
166
|
},
|
|
167
167
|
}),
|
|
168
168
|
];
|