Skip to content

Commit

Permalink
another attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
ssh51117 committed May 16, 2024
1 parent 57d0afd commit 8faebc6
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ it("test successful create trainspace call", async () => {
httpStatusCode: 200,
}
})
//@ts-expect-error 1
//@ts-expect-error : we only need authorization and body
const event: APIGatewayProxyEventV2 = {
headers: {
authorization: 'abcd',
Expand All @@ -50,7 +50,7 @@ it("test internal service error", async () => {
httpStatusCode: 456,
}
})
// @ts-expect-error 2
//@ts-expect-error
const event: APIGatewayProxyEventV2 = {
headers: {
authorization: 'abcd',
Expand All @@ -75,7 +75,7 @@ it("test undefined event", async () => {
httpStatusCode: 400,
}
})
// @ts-expect-error 3
//@ts-expect-error : see test name
const result = await handler(undefined);
expect(result.statusCode).toEqual(404);
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ it("test successful delete all trainspace call", async () => {
}
})

//@ts-expect-error 1
//@ts-expect-error : we only need the authorization
const event: APIGatewayProxyEventV2 = {
headers: {
authorization: 'abcd',
Expand All @@ -55,7 +55,7 @@ it("test no batch delete response call", async () => {
}
})

//@ts-expect-error 2
//@ts-expect-error : see above note
const event: APIGatewayProxyEventV2 = {
headers: {
authorization: 'abcd',
Expand All @@ -80,7 +80,7 @@ it("test incorrect batch delete response failed call", async () => {
}
})

//@ts-expect-error 3
//@ts-expect-error
const event: APIGatewayProxyEventV2 = {
headers: {
authorization: 'abcd',
Expand All @@ -103,7 +103,7 @@ it("test delete all on no existing trainspaces call", async () => {
}
})

//@ts-expect-error 4
//@ts-expect-error
const event: APIGatewayProxyEventV2 = {
headers: {
authorization: 'abcd',
Expand All @@ -116,7 +116,7 @@ it("test delete all on no existing trainspaces call", async () => {

it("test malformed call", async () => {

// @ts-expect-error 5
//@ts-expect-error : testing call with undefined parameters
const result = await handler(undefined);
expect(result.statusCode).toEqual(400);
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ it("test successful delete trainspace call", async () => {
httpStatusCode: 200,
}
})
//@ts-expect-error 1
//@ts-expect-error : we only need authorization, id, and a body
const event: APIGatewayProxyEventV2 = {
headers: {
authorization: 'abcd',
Expand All @@ -50,7 +50,7 @@ it("test no response failed operation call", async () => {
}
})

//@ts-expect-error 2
//@ts-expect-error : same as above
const event: APIGatewayProxyEventV2 = {
headers: {
authorization: 'abcd',
Expand All @@ -76,7 +76,7 @@ it("test different status code failed operation call", async () => {
httpStatusCode: 267,
}
})
//@ts-expect-error 3
//@ts-expect-error : see above
const event: APIGatewayProxyEventV2 = {
headers: {
authorization: 'abcd',
Expand All @@ -102,7 +102,7 @@ it("test no trainspace id given", async () => {
}
})

//@ts-expect-error 4
//@ts-expect-error : we are giving an empty event
const event: APIGatewayProxyEventV2 = {
pathParameters: {
}
Expand All @@ -114,7 +114,7 @@ it("test no trainspace id given", async () => {


it("test malformed call", async () => {
// @ts-expect-error 5
// @ts-expect-error : testing for null parameter response
const result = await handler(undefined);
expect(result.statusCode).toEqual(400);
});
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ it("test successful get all trainspace call", async () => {
}],
"Count": 4
});
// @ts-expect-error 1
//@ts-expect-error
const event: APIGatewayProxyEventV2 = {
headers: {
authorization: 'abcd',
Expand All @@ -42,7 +42,7 @@ it("test no existing trainspaces for user id", async () => {
Items: undefined
})

//@ts-expect-error 2
//@ts-expect-error
const event: APIGatewayProxyEventV2 = {
headers: {
authorization: 'abcd',
Expand All @@ -54,7 +54,7 @@ it("test no existing trainspaces for user id", async () => {
});

it("test malformed request", async () => {
// @ts-expect-error 3
//@ts-expect-error
const result = await handler(undefined);
expect(result.statusCode).toEqual(400);
});
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ it("test no existing trainspace id", async () => {
Item: undefined
})

// @ts-expect-error
//@ts-expect-error
const event: APIGatewayProxyEventV2 = {
pathParameters: {
id: "some trainspace_id"
Expand All @@ -56,7 +56,7 @@ it("test no trainspace id given", async () => {
Item: { trainspaceID: { S: 'sample trainspace id' } }
})

// @ts-expect-error
//@ts-expect-error
const event: APIGatewayProxyEventV2 = {
pathParameters: {
}
Expand All @@ -67,7 +67,7 @@ it("test no trainspace id given", async () => {
});

it("test malformed request", async () => {
// @ts-expect-error : we are trying to cause an error
//@ts-expect-error
const result = await handler(undefined);
expect(result.statusCode).toEqual(400);
});
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ it("test successful create user call", async () => {
httpStatusCode: 200,
}
})
//@ts-expect-error 1
//@ts-expect-error
const event: APIGatewayProxyEventV2 = {
headers: {
authorization: 'abcd',
Expand All @@ -46,7 +46,7 @@ it("test internal service error", async () => {
httpStatusCode: 456,
}
})
// @ts-expect-error 2
//@ts-expect-error
const event: APIGatewayProxyEventV2 = {
headers: {
authorization: 'abcd',
Expand All @@ -68,7 +68,7 @@ it("test undefined event", async () => {
httpStatusCode: 400,
}
})
// @ts-expect-error 3
//@ts-expect-error
const result = await handler(undefined);
expect(result.statusCode).toEqual(404);
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ it("test successful delete user call", async () => {
httpStatusCode: 200,
}
})
// @ts-expect-error
//@ts-expect-error
const event: APIGatewayProxyEventV2 = {
headers: {
authorization: 'abcd',
Expand All @@ -46,7 +46,7 @@ it("test no response failed operation call", async () => {
}
})

// @ts-expect-error
//@ts-expect-error
const event: APIGatewayProxyEventV2 = {
headers: {
authorization: 'abcd',
Expand All @@ -68,7 +68,7 @@ it("test different status code failed operation call", async () => {
httpStatusCode: 267,
}
})
// @ts-expect-error
//@ts-expect-error
const event: APIGatewayProxyEventV2 = {
headers: {
authorization: 'abcd',
Expand All @@ -85,7 +85,7 @@ it("test different status code failed operation call", async () => {
});

it("test malformed call", async () => {
// @ts-expect-error : we are trying to cause an error
//@ts-expect-error
const result = await handler(undefined);
expect(result.statusCode).toEqual(400);
});
6 changes: 3 additions & 3 deletions serverless/packages/functions/src/user/tests/get_user.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ it("test successful get user call", async () => {
Item: { user_id: { S: 'UID' } }
})

// @ts-expect-error
//@ts-expect-error
const event: APIGatewayProxyEventV2 = {
headers: {
authorization: 'abcd',
Expand All @@ -38,7 +38,7 @@ it("test no existing user id", async () => {
Item: undefined
})

// @ts-expect-error
//@ts-expect-error
const event: APIGatewayProxyEventV2 = {
headers: {
authorization: 'abcd',
Expand All @@ -50,7 +50,7 @@ it("test no existing user id", async () => {
});

it("test malformed request", async () => {
// @ts-expect-error : we are trying to cause an error
//@ts-expect-error
const result = await handler(undefined);
expect(result.statusCode).toEqual(400);
});

0 comments on commit 8faebc6

Please sign in to comment.