Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 15 additions & 21 deletions __tests__/utils/stub500.mts
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,27 @@
*/

/**
* Create an object with a method named `method` that throws an error.
* Create a function that throws an error.
*
* @this {void}
*
* @param {string} url
* The endpoint being tested
* @param {string} method
* The name of the method to stub
* @return {Record<string, (this: void) => never>}
* Object with `method` stub
* @return {(this: void) => never}
* Error stub
*/
function stub500(
this: void,
url: string,
method: string
): Record<string, (this: void) => never> {
return {
/**
* @this {void}
*
* @return {never}
* Never
* @throws {Error}
*/
[method](this: void): never {
throw new Error(url)
}
function stub500(this: void, url: string): (this: void) => never {
return stub

/**
* @this {void}
*
* @return {never}
* Never
* @throws {Error}
*/
function stub(this: void): never {
throw new Error(url)
}
}

Expand Down
96 changes: 96 additions & 0 deletions src/__snapshots__/app.e2e.snap
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,75 @@ exports[`e2e:app > GET / > should respond with api documentation (json) 1`] = `
"tags": [
"accounts"
]
},
"get": {
"operationId": "accounts-get",
"parameters": [
{
"name": "uid",
"required": true,
"in": "path",
"description": "id of account to retrieve",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AccountPayload"
}
}
}
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/InvalidCredentialException"
}
}
}
},
"403": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AccessDeniedException"
}
}
}
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MissingAccountException"
}
}
}
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/InternalServerException"
}
}
}
}
},
"security": [
{
"jwt": []
}
],
"tags": [
"accounts"
]
}
},
"/accounts/whoami": {
Expand Down Expand Up @@ -245,6 +314,33 @@ exports[`e2e:app > GET / > should respond with api documentation (json) 1`] = `
"uid"
]
},
"AccountPayload": {
"type": "object",
"properties": {
"email": {
"type": "string",
"description": "primary email address",
"format": "email"
},
"type": {
"type": "string",
"description": "account type",
"enum": [
"developer",
"user"
]
},
"uid": {
"type": "string",
"description": "unique account id"
}
},
"required": [
"email",
"type",
"uid"
]
},
"CreateAccountCommand": {
"type": "object",
"properties": {
Expand Down
Loading