0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-31 22:51:25 -05:00

feat(core): remove unnecessary variable check and unused route (#1084)

This commit is contained in:
Darcy Ye 2022-06-09 16:24:47 +08:00 committed by GitHub
parent b9ca929ccc
commit bcc05e521d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 39 deletions

View file

@ -543,26 +543,6 @@ describe('sessionRoutes', () => {
});
});
describe('GET /session/register/:username/existence', () => {
it('property existence is false in response if username exists', async () => {
const response = await sessionRequest.get('/session/register/username/existence');
expect(response.body).toHaveProperty('existence', false);
});
it('throw error if username not valid', async () => {
const usernameStartedWithNumber = '1username';
const response = await sessionRequest.get(
`/session/register/${usernameStartedWithNumber}/existence`
);
expect(response.statusCode).toEqual(400);
});
it('property existence is true in response if username exists', async () => {
const response = await sessionRequest.get('/session/register/username1/existence');
expect(response.body).toHaveProperty('existence', true);
});
});
describe('POST /session/register/passwordless/sms/send-passcode', () => {
beforeAll(() => {
interactionDetails.mockResolvedValueOnce({

View file

@ -337,13 +337,6 @@ export default function sessionRoutes<T extends AnonymousRouter>(router: T, prov
const type = 'RegisterUsernamePassword';
ctx.log(type, { username });
assertThat(
password,
new RequestError({
code: 'session.insufficient_info',
status: 400,
})
);
assertThat(
!(await hasUser(username)),
new RequestError({
@ -370,18 +363,6 @@ export default function sessionRoutes<T extends AnonymousRouter>(router: T, prov
}
);
router.get(
'/session/register/:username/existence',
koaGuard({ params: object({ username: string().regex(usernameRegEx) }) }),
async (ctx, next) => {
const { username } = ctx.guard.params;
ctx.body = { existence: await hasUser(username) };
return next();
}
);
router.post(
'/session/register/passwordless/sms/send-passcode',
koaGuard({ body: object({ phone: string().regex(phoneRegEx) }) }),