Skip to content

Commit

Permalink
Add a test for multiple game cookies
Browse files Browse the repository at this point in the history
gh-250

This test currently fails with the exact error I just got in the
deployed app.
  • Loading branch information
douglasnaphas committed Mar 26, 2022
1 parent 651fba4 commit b5097f2
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions backend/connect.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,78 @@ describe("connect", () => {
},
expectedStatus: 200,
},
// multiple game cookies - the right one is 2nd of 2
{
description: "happy path 2",
fakeTime: fakeTime2,
tableName: "you_know",
event: {
headers: {
Cookie:
`41e3d9a61dba1322a63b98798d5af58d5dace0a112c2984ea7716c2caf40ec35=BJIVMQIZTFRXXVSAWUXGFWBWGYLCPN` +
";" +
`${(
"61D034473102D7DAC305902770471FD50F4C5B26F6831A56D" +
"D90B5184B3C30FC"
).toLowerCase()}=SOMESESSIONKEYABCXYZ`,
},
multiValueHeaders: {
Cookie: [
`41e3d9a61dba1322a63b98798d5af58d5dace0a112c2984ea7716c2caf40ec35=BJIVMQIZTFRXXVSAWUXGFWBWGYLCPN` +
";" +
`${(
"61D034473102D7DAC305902770471FD50F4C5B26F6831A56D" +
"D90B5184B3C30FC"
).toLowerCase()}=SOMESESSIONKEYABCXYZ`,
],
},
queryStringParameters: {
gamename: "some%20string",
roomcode: "XSMORM",
},
multiValueQueryStringParameters: {
gamename: ["some%20string"],
roomcode: ["XSMORM"],
},
requestContext: {
connectionId: "LaFr-fl2oAxCJf4=",
},
},
Item: {
lib_id: `participant#${(
"61D034473102D7DAC305902770471FD50F4C5B26F6831A56D" +
"D90B5184B3C30FC"
).toLowerCase()}`,
room_code: "XSMORM",
session_key: "SOMESESSIONKEYABCXYZ",
game_name: "some%20string",
},
expectedGetParticipantParams: {
TableName: "you_know",
Key: {
[schema.PARTITION_KEY]: "XSMORM",
[schema.SORT_KEY]:
`${schema.PARTICIPANT_PREFIX}` +
`${schema.SEPARATOR}` +
`${(
"61D034473102D7DAC305902770471FD50F4C5B26F6831A56D" +
"D90B5184B3C30FC"
).toLowerCase()}`,
},
},
expectedPutParams: {
TableName: "you_know",
Item: {
[schema.PARTITION_KEY]: `XSMORM`,
[schema.SORT_KEY]:
`${schema.CONNECT}` + `${schema.SEPARATOR}` + "LaFr-fl2oAxCJf4=",
[schema.CONNECTION_ID]: "LaFr-fl2oAxCJf4=",
[schema.DATE]: fakeTime2.toISOString(),
[schema.MS]: fakeTime2.getTime(),
},
},
expectedStatus: 200,
},
// Item not found
{
description: "Item not found",
Expand Down

0 comments on commit b5097f2

Please sign in to comment.