From 99172cd9edaf3608239bdfac96e4e4cca1633bea Mon Sep 17 00:00:00 2001 From: Sabir Hassan Date: Fri, 22 Jul 2022 22:18:03 +0500 Subject: [PATCH] chore: add specs --- api/src/routes/api/spec/drive.spec.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/api/src/routes/api/spec/drive.spec.ts b/api/src/routes/api/spec/drive.spec.ts index 4e8a875..dfc5f8b 100644 --- a/api/src/routes/api/spec/drive.spec.ts +++ b/api/src/routes/api/spec/drive.spec.ts @@ -1099,6 +1099,26 @@ describe('drive', () => { }) }) + it('should respond with Bad Request if the oldPath is missing', async () => { + const res = await request(app) + .post(renameApi) + .auth(accessToken, { type: 'bearer' }) + .send({ newPath: 'newPath' }) + .expect(400) + + expect(res.text).toEqual(`\"oldPath\" is required`) + }) + + it('should respond with Bad Request if the newPath is missing', async () => { + const res = await request(app) + .post(renameApi) + .auth(accessToken, { type: 'bearer' }) + .send({ oldPath: 'oldPath' }) + .expect(400) + + expect(res.text).toEqual(`\"newPath\" is required`) + }) + it('should respond with Bad Request if the oldPath is outside drive', async () => { const res = await request(app) .post(renameApi)