-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: filtering on gameserverId when searching module installations
- Loading branch information
1 parent
c05ea96
commit b03529d
Showing
4 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
packages/app-api/src/controllers/__tests__/bugRepro.integration.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { IntegrationTest, expect, SetupGameServerPlayers } from '@takaro/test'; | ||
import { randomUUID } from 'crypto'; | ||
|
||
const group = 'Bug repros'; | ||
|
||
const tests = [ | ||
new IntegrationTest<SetupGameServerPlayers.ISetupData>({ | ||
group, | ||
snapshot: false, | ||
setup: SetupGameServerPlayers.setup, | ||
name: 'When searching module installs, filtering by gameserverId works properly', | ||
/** | ||
* Install a module on server A | ||
* Search for installs on server A -> should return 1 result | ||
* Then search for installs on server B -> should return 0 results | ||
*/ | ||
test: async function () { | ||
const module = (await this.client.module.moduleControllerCreate({ name: randomUUID() })).data.data; | ||
const gameServerA = this.setupData.gameServer1; | ||
const gameServerB = this.setupData.gameServer2; | ||
|
||
await this.client.module.moduleInstallationsControllerInstallModule({ | ||
gameServerId: gameServerA.id, | ||
versionId: module.latestVersion.id, | ||
}); | ||
|
||
const installsA = await this.client.module.moduleInstallationsControllerGetInstalledModules({ | ||
filters: { gameserverId: [gameServerA.id] }, | ||
}); | ||
const installsB = await this.client.module.moduleInstallationsControllerGetInstalledModules({ | ||
filters: { gameserverId: [gameServerB.id] }, | ||
}); | ||
|
||
expect(installsA.data.data.length).to.equal(1); | ||
expect(installsB.data.data.length).to.equal(0); | ||
}, | ||
}), | ||
]; | ||
|
||
describe(group, function () { | ||
tests.forEach((test) => { | ||
test.run(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters