@takaro/modules 0.0.4 → 0.0.5
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/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/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 = 'Role expiry';
|
|
@@ -20,7 +20,7 @@ const tests = [
|
|
|
20
20
|
this.setupData.teleportsModule.id,
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
const eventsBeforeRole = this.
|
|
23
|
+
const eventsBeforeRole = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
24
24
|
|
|
25
25
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
26
26
|
msg: '/settp test',
|
|
@@ -28,7 +28,7 @@ const tests = [
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
expect((await eventsBeforeRole).length).to.be.eq(1);
|
|
31
|
-
expect((await eventsBeforeRole)[0].data.msg).to.match(/You do not have permission to use teleports/);
|
|
31
|
+
expect((await eventsBeforeRole)[0].data.meta.msg).to.match(/You do not have permission to use teleports/);
|
|
32
32
|
|
|
33
33
|
// Assign the role with expiry 10 minutes from now
|
|
34
34
|
await this.client.player.playerControllerAssignRole(this.setupData.players[0].id, this.setupData.role.id, {
|
|
@@ -36,7 +36,7 @@ const tests = [
|
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
// Execute the command again. Now it should work, since the role is assigned
|
|
39
|
-
const eventsWithRole = this.
|
|
39
|
+
const eventsWithRole = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
40
40
|
|
|
41
41
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
42
42
|
msg: '/settp test2',
|
|
@@ -44,7 +44,7 @@ const tests = [
|
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
expect((await eventsWithRole).length).to.be.eq(1);
|
|
47
|
-
expect((await eventsWithRole)[0].data.msg).to.match(/Teleport test2 set/);
|
|
47
|
+
expect((await eventsWithRole)[0].data.meta.msg).to.match(/Teleport test2 set/);
|
|
48
48
|
|
|
49
49
|
// Remove the role and reassign with expiry 1 ms from now
|
|
50
50
|
await this.client.player.playerControllerRemoveRole(this.setupData.players[0].id, this.setupData.role.id);
|
|
@@ -53,7 +53,7 @@ const tests = [
|
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
// Execute the command again. Now it should not work, since the role is expired
|
|
56
|
-
const eventsAfterExpire = this.
|
|
56
|
+
const eventsAfterExpire = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
57
57
|
|
|
58
58
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
59
59
|
msg: '/settp test3',
|
|
@@ -61,7 +61,7 @@ const tests = [
|
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
expect((await eventsAfterExpire).length).to.be.eq(1);
|
|
64
|
-
expect((await eventsAfterExpire)[0].data.msg).to.match(/You do not have permission to use teleports/);
|
|
64
|
+
expect((await eventsAfterExpire)[0].data.meta.msg).to.match(/You do not have permission to use teleports/);
|
|
65
65
|
},
|
|
66
66
|
}),
|
|
67
67
|
];
|
|
@@ -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
|
import { sleep } from '@takaro/util';
|
|
4
4
|
|
|
@@ -16,7 +16,7 @@ const tests = [
|
|
|
16
16
|
this.setupData.serverMessagesModule.id,
|
|
17
17
|
);
|
|
18
18
|
|
|
19
|
-
const events = this.
|
|
19
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
20
20
|
|
|
21
21
|
await this.client.cronjob.cronJobControllerTrigger({
|
|
22
22
|
cronjobId: this.setupData.serverMessagesModule.cronJobs[0].id,
|
|
@@ -25,7 +25,7 @@ const tests = [
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
expect((await events).length).to.be.eq(1);
|
|
28
|
-
expect((await events)[0].data.msg).to.be.eq(
|
|
28
|
+
expect((await events)[0].data.meta.msg).to.be.eq(
|
|
29
29
|
// eslint-disable-next-line
|
|
30
30
|
"This is an automated message, don't forget to read the server rules!",
|
|
31
31
|
);
|
|
@@ -47,7 +47,7 @@ const tests = [
|
|
|
47
47
|
},
|
|
48
48
|
);
|
|
49
49
|
|
|
50
|
-
const events = this.
|
|
50
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
51
51
|
|
|
52
52
|
await this.client.cronjob.cronJobControllerTrigger({
|
|
53
53
|
cronjobId: this.setupData.serverMessagesModule.cronJobs[0].id,
|
|
@@ -56,7 +56,7 @@ const tests = [
|
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
expect((await events).length).to.be.eq(1);
|
|
59
|
-
expect((await events)[0].data.msg).to.be.eq('This is a custom message');
|
|
59
|
+
expect((await events)[0].data.meta.msg).to.be.eq('This is a custom message');
|
|
60
60
|
},
|
|
61
61
|
}),
|
|
62
62
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -78,7 +78,10 @@ const tests = [
|
|
|
78
78
|
// We should see each of our test messages at least once
|
|
79
79
|
|
|
80
80
|
const numberOfEvents = 10;
|
|
81
|
-
const events = this.
|
|
81
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(
|
|
82
|
+
GameEvents.CHAT_MESSAGE,
|
|
83
|
+
numberOfEvents,
|
|
84
|
+
);
|
|
82
85
|
|
|
83
86
|
for (let i = 0; i < numberOfEvents; i++) {
|
|
84
87
|
await sleep(Math.floor(Math.random() * 10) + 1);
|
|
@@ -89,7 +92,7 @@ const tests = [
|
|
|
89
92
|
});
|
|
90
93
|
}
|
|
91
94
|
|
|
92
|
-
const messages = (await events).map((e) => e.data.msg);
|
|
95
|
+
const messages = (await events).map((e) => e.data.meta.msg);
|
|
93
96
|
expect(messages).to.include('Test message 1');
|
|
94
97
|
expect(messages).to.include('Test message 2');
|
|
95
98
|
},
|
|
@@ -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
|
import { sleep } from '@takaro/util';
|
|
4
4
|
|
|
@@ -30,14 +30,14 @@ const customSetup = async function (this: IntegrationTest<IModuleTestsSetupData>
|
|
|
30
30
|
},
|
|
31
31
|
);
|
|
32
32
|
|
|
33
|
-
const setEvents =
|
|
33
|
+
const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
34
34
|
await this.client.command.commandControllerTrigger(setupData.gameserver.id, {
|
|
35
35
|
msg: '/settp test',
|
|
36
36
|
playerId: setupData.players[0].id,
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
expect((await setEvents).length).to.be.eq(1);
|
|
40
|
-
expect((await setEvents)[0].data.msg).to.be.eq('Teleport test set.');
|
|
40
|
+
expect((await setEvents)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
41
41
|
|
|
42
42
|
const giveCurrencies = setupData.players.map(async (player) => {
|
|
43
43
|
const playerOnGameServer = (
|
|
@@ -66,7 +66,7 @@ const tests = [
|
|
|
66
66
|
setup: customSetup,
|
|
67
67
|
name: 'Deducts money when cost is configured',
|
|
68
68
|
test: async function () {
|
|
69
|
-
const events = this.
|
|
69
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents('command-executed', 1);
|
|
70
70
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
71
71
|
msg: '/tp test',
|
|
72
72
|
playerId: this.setupData.players[0].id,
|
|
@@ -91,7 +91,7 @@ const tests = [
|
|
|
91
91
|
test: async function () {
|
|
92
92
|
const amount = 10;
|
|
93
93
|
|
|
94
|
-
const setEvents = this.
|
|
94
|
+
const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents('command-executed', amount);
|
|
95
95
|
|
|
96
96
|
await Promise.all(
|
|
97
97
|
Array.from({ length: amount }).map(async (_, index) => {
|
|
@@ -105,7 +105,7 @@ const tests = [
|
|
|
105
105
|
|
|
106
106
|
expect((await setEvents).length).to.be.eq(amount);
|
|
107
107
|
|
|
108
|
-
const events = this.
|
|
108
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents('command-executed', amount);
|
|
109
109
|
await Promise.all(
|
|
110
110
|
Array.from({ length: amount }).map(async (_, index) => {
|
|
111
111
|
await sleep(1);
|
|
@@ -136,7 +136,7 @@ const tests = [
|
|
|
136
136
|
setup: customSetup,
|
|
137
137
|
name: 'Does not deduct currency when command unsuccessful',
|
|
138
138
|
test: async function () {
|
|
139
|
-
const events = this.
|
|
139
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents('command-executed', 1);
|
|
140
140
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
141
141
|
msg: '/tp doesntexist',
|
|
142
142
|
playerId: this.setupData.players[0].id,
|
|
@@ -176,14 +176,14 @@ const tests = [
|
|
|
176
176
|
},
|
|
177
177
|
);
|
|
178
178
|
|
|
179
|
-
const events = this.
|
|
179
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
180
180
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
181
181
|
msg: '/tp test',
|
|
182
182
|
playerId: this.setupData.players[1].id,
|
|
183
183
|
});
|
|
184
184
|
|
|
185
185
|
expect((await events).length).to.be.eq(1);
|
|
186
|
-
expect((await events)[0].data.msg).to.be.eq('You do not have enough currency to execute this command.');
|
|
186
|
+
expect((await events)[0].data.meta.msg).to.be.eq('You do not have enough currency to execute this command.');
|
|
187
187
|
},
|
|
188
188
|
}),
|
|
189
189
|
];
|
|
@@ -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,7 +15,7 @@ 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, 3);
|
|
19
19
|
|
|
20
20
|
await Promise.all(
|
|
21
21
|
Array.from({ length: 3 }).map(async (_, i) => {
|
|
@@ -29,10 +29,10 @@ const tests = [
|
|
|
29
29
|
expect((await setEvents).length).to.be.eq(3);
|
|
30
30
|
|
|
31
31
|
for (const event of await setEvents) {
|
|
32
|
-
expect(event.data.msg).to.match(/Teleport test\d set\./);
|
|
32
|
+
expect(event.data.meta.msg).to.match(/Teleport test\d set\./);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
const events = this.
|
|
35
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 4);
|
|
36
36
|
|
|
37
37
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
38
38
|
msg: '/tplist',
|
|
@@ -40,10 +40,10 @@ const tests = [
|
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
expect((await events).length).to.be.eq(4);
|
|
43
|
-
expect((await events)[0].data.msg).to.be.eq('You have 3 teleports available');
|
|
44
|
-
expect((await events)[1].data.msg).to.match(/test0: \([-\d]+,[-\d]+,[-\d]+\)/);
|
|
45
|
-
expect((await events)[2].data.msg).to.match(/test1: \([-\d]+,[-\d]+,[-\d]+\)/);
|
|
46
|
-
expect((await events)[3].data.msg).to.match(/test2: \([-\d]+,[-\d]+,[-\d]+\)/);
|
|
43
|
+
expect((await events)[0].data.meta.msg).to.be.eq('You have 3 teleports available');
|
|
44
|
+
expect((await events)[1].data.meta.msg).to.match(/test0: \([-\d]+,[-\d]+,[-\d]+\)/);
|
|
45
|
+
expect((await events)[2].data.meta.msg).to.match(/test1: \([-\d]+,[-\d]+,[-\d]+\)/);
|
|
46
|
+
expect((await events)[3].data.meta.msg).to.match(/test2: \([-\d]+,[-\d]+,[-\d]+\)/);
|
|
47
47
|
},
|
|
48
48
|
}),
|
|
49
49
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -62,7 +62,7 @@ const tests = [
|
|
|
62
62
|
},
|
|
63
63
|
);
|
|
64
64
|
|
|
65
|
-
const setTpEvent = this.
|
|
65
|
+
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
66
66
|
|
|
67
67
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
68
68
|
msg: '/settp test',
|
|
@@ -70,9 +70,9 @@ const tests = [
|
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
expect((await setTpEvent).length).to.be.eq(1);
|
|
73
|
-
expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
|
|
73
|
+
expect((await setTpEvent)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
74
74
|
|
|
75
|
-
const setPublicEvent = this.
|
|
75
|
+
const setPublicEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
76
76
|
|
|
77
77
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
78
78
|
msg: '/setpublic test',
|
|
@@ -80,9 +80,9 @@ const tests = [
|
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
expect((await setPublicEvent).length).to.be.eq(1);
|
|
83
|
-
expect((await setPublicEvent)[0].data.msg).to.be.eq('Teleport test is now public.');
|
|
83
|
+
expect((await setPublicEvent)[0].data.meta.msg).to.be.eq('Teleport test is now public.');
|
|
84
84
|
|
|
85
|
-
const setTpEvent2 = this.
|
|
85
|
+
const setTpEvent2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
86
86
|
|
|
87
87
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
88
88
|
msg: '/settp test2',
|
|
@@ -90,9 +90,9 @@ const tests = [
|
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
expect((await setTpEvent2).length).to.be.eq(1);
|
|
93
|
-
expect((await setTpEvent2)[0].data.msg).to.be.eq('Teleport test2 set.');
|
|
93
|
+
expect((await setTpEvent2)[0].data.meta.msg).to.be.eq('Teleport test2 set.');
|
|
94
94
|
|
|
95
|
-
const tpEvent = this.
|
|
95
|
+
const tpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 2);
|
|
96
96
|
|
|
97
97
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
98
98
|
msg: '/tplist',
|
|
@@ -100,8 +100,8 @@ const tests = [
|
|
|
100
100
|
});
|
|
101
101
|
|
|
102
102
|
expect((await tpEvent).length).to.be.eq(2);
|
|
103
|
-
expect((await tpEvent)[0].data.msg).to.be.eq('You have 1 teleport available');
|
|
104
|
-
expect((await tpEvent)[1].data.msg).to.match(/test: \([-\d]+,[-\d]+,[-\d]+\) \(public\)/);
|
|
103
|
+
expect((await tpEvent)[0].data.meta.msg).to.be.eq('You have 1 teleport available');
|
|
104
|
+
expect((await tpEvent)[1].data.meta.msg).to.match(/test: \([-\d]+,[-\d]+,[-\d]+\) \(public\)/);
|
|
105
105
|
},
|
|
106
106
|
}),
|
|
107
107
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -115,7 +115,7 @@ const tests = [
|
|
|
115
115
|
this.setupData.teleportsModule.id,
|
|
116
116
|
);
|
|
117
117
|
|
|
118
|
-
const setTpEvent = this.
|
|
118
|
+
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
119
119
|
|
|
120
120
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
121
121
|
msg: '/settp test',
|
|
@@ -123,9 +123,9 @@ const tests = [
|
|
|
123
123
|
});
|
|
124
124
|
|
|
125
125
|
expect((await setTpEvent).length).to.be.eq(1);
|
|
126
|
-
expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
|
|
126
|
+
expect((await setTpEvent)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
127
127
|
|
|
128
|
-
const tpEvent = this.
|
|
128
|
+
const tpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
129
129
|
|
|
130
130
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
131
131
|
msg: '/tplist',
|
|
@@ -133,7 +133,9 @@ const tests = [
|
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
expect((await tpEvent).length).to.be.eq(1);
|
|
136
|
-
expect((await tpEvent)[0].data.msg).to.be.eq(
|
|
136
|
+
expect((await tpEvent)[0].data.meta.msg).to.be.eq(
|
|
137
|
+
'You have no teleports available, use /settp <name> to set one.',
|
|
138
|
+
);
|
|
137
139
|
},
|
|
138
140
|
}),
|
|
139
141
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -148,7 +150,7 @@ const tests = [
|
|
|
148
150
|
this.setupData.teleportsModule.id,
|
|
149
151
|
);
|
|
150
152
|
|
|
151
|
-
const setTpEvent = this.
|
|
153
|
+
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
152
154
|
|
|
153
155
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
154
156
|
msg: '/settp test',
|
|
@@ -156,9 +158,9 @@ const tests = [
|
|
|
156
158
|
});
|
|
157
159
|
|
|
158
160
|
expect((await setTpEvent).length).to.be.eq(1);
|
|
159
|
-
expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
|
|
161
|
+
expect((await setTpEvent)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
160
162
|
|
|
161
|
-
const setTpEvent2 = this.
|
|
163
|
+
const setTpEvent2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
162
164
|
|
|
163
165
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
164
166
|
msg: '/settp test2',
|
|
@@ -166,9 +168,9 @@ const tests = [
|
|
|
166
168
|
});
|
|
167
169
|
|
|
168
170
|
expect((await setTpEvent2).length).to.be.eq(1);
|
|
169
|
-
expect((await setTpEvent2)[0].data.msg).to.be.eq('Teleport test2 set.');
|
|
171
|
+
expect((await setTpEvent2)[0].data.meta.msg).to.be.eq('Teleport test2 set.');
|
|
170
172
|
|
|
171
|
-
const tpEvent = this.
|
|
173
|
+
const tpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 2);
|
|
172
174
|
|
|
173
175
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
174
176
|
msg: '/tplist',
|
|
@@ -176,8 +178,8 @@ const tests = [
|
|
|
176
178
|
});
|
|
177
179
|
|
|
178
180
|
expect((await tpEvent).length).to.be.eq(2);
|
|
179
|
-
expect((await tpEvent)[0].data.msg).to.be.eq('You have 1 teleport available');
|
|
180
|
-
expect((await tpEvent)[1].data.msg).to.match(/test2: \([-\d]+,[-\d]+,[-\d]+\)/);
|
|
181
|
+
expect((await tpEvent)[0].data.meta.msg).to.be.eq('You have 1 teleport available');
|
|
182
|
+
expect((await tpEvent)[1].data.meta.msg).to.match(/test2: \([-\d]+,[-\d]+,[-\d]+\)/);
|
|
181
183
|
},
|
|
182
184
|
}),
|
|
183
185
|
];
|
|
@@ -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
|
},
|