Skip to content

Commit

Permalink
fix(server): Use namespaced ID to delete persisted game data (#531)
Browse files Browse the repository at this point in the history
* fix(server): Use namespaced ID to delete persisted game data

* test(server): Update API test for implementation change

* style(server): Fix lint error
  • Loading branch information
delucis authored and nicolodavis committed Dec 14, 2019
1 parent 35cb2be commit 2d931e9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/server/api.test.js
Expand Up @@ -523,7 +523,7 @@ describe('.createApiServer', () => {
response = await request(app.callback())
.post('/games/foo/1/leave')
.send('playerID=0&credentials=SECRET1');
expect(setSpy).toHaveBeenCalledWith('1');
expect(setSpy).toHaveBeenCalledWith(expect.stringMatching(':1'));
expect(setSpy).toHaveBeenCalledWith(
expect.stringMatching(':metadata')
);
Expand Down
2 changes: 1 addition & 1 deletion src/server/api.ts
Expand Up @@ -205,7 +205,7 @@ export const addApiToServer = ({ app, db, games, lobbyConfig }) => {
await db.set(GameMetadataKey(namespacedGameID), gameMetadata);
} else {
// remove room
await db.remove(roomID);
await db.remove(namespacedGameID);
await db.remove(GameMetadataKey(namespacedGameID));
}
ctx.body = {};
Expand Down

0 comments on commit 2d931e9

Please sign in to comment.