Skip to content

Node.js based forum software built for the modern web

fix(emails): broken test due to sticky registration interstitial

Julian Lamab9b6716939d
diff --git a/public/openapi/read/user/userslug/edit/email.yaml b/public/openapi/read/user/userslug/edit/email.yaml
index 2ca8d41392..b8fd327d5e 100644
--- a/public/openapi/read/user/userslug/edit/email.yaml
+++ b/public/openapi/read/user/userslug/edit/email.yaml
@@ -13,15 +13,15 @@ get:
"200":
description: ""
content:
- application/json:
+ text/plain:
schema:
- allOf:
- - $ref: ../../../../components/schemas/UserObject.yaml#/UserObjectFull
- - type: object
- properties:
- hasPassword:
- type: boolean
- title:
- type: string
- - $ref: ../../../../components/schemas/Breadcrumbs.yaml#/Breadcrumbs
- - $ref: ../../../../components/schemas/CommonProps.yaml#/CommonProps
\ No newline at end of file
+ type: string
+ description: A relative path to the registration interstitial page so they can add or update an email for their account
+ example: /register/complete
+ "302":
+ description: Redirects the user to a registration interstitial page so they can add or update an email for their account
+ headers:
+ Location:
+ schema:
+ type: string
+ example: /register/complete
\ No newline at end of file
diff --git a/test/api.js b/test/api.js
index ab7c724695..7b40145bcb 100644
--- a/test/api.js
+++ b/test/api.js
@@ -466,6 +466,18 @@ describe('API', async () => {
csrfToken = config.csrf_token;
}
});
+
+ it('should back out of a registration interstitial if needed', async () => {
+ const affectedPaths = ['GET /api/user/{userslug}/edit/email'];
+ if (affectedPaths.includes(`${method.toUpperCase()} ${path}`)) {
+ await request({
+ uri: `${nconf.get('url')}/register/abort`,
+ method: 'POST',
+ jar,
+ simple: false,
+ });
+ }
+ });
});
});
}