From 48fe7994ecf7e3044e74e61b082597ed2ca1bc44 Mon Sep 17 00:00:00 2001 From: Yury Shkoda Date: Thu, 28 Oct 2021 12:09:19 +0000 Subject: [PATCH] chore(routes): change files route with drive --- src/routes/api/{files.ts => drive.ts} | 6 +++--- src/routes/api/index.ts | 4 ++-- src/routes/api/spec/{routes.spec.ts => drive.spec.ts} | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) rename src/routes/api/{files.ts => drive.ts} (87%) rename src/routes/api/spec/{routes.spec.ts => drive.spec.ts} (97%) diff --git a/src/routes/api/files.ts b/src/routes/api/drive.ts similarity index 87% rename from src/routes/api/files.ts rename to src/routes/api/drive.ts index c8b81fc..c3724ab 100644 --- a/src/routes/api/files.ts +++ b/src/routes/api/drive.ts @@ -2,9 +2,9 @@ import express from 'express' import { createFileTree, getTreeExample } from '../../controllers' import { isFileTree } from '../../types' -const filesRouter = express.Router() +const driveRouter = express.Router() -filesRouter.post('/deploy', async (req, res) => { +driveRouter.post('/deploy', async (req, res) => { if (!isFileTree(req.body.fileTree)) { res.status(400).send({ status: 'failure', @@ -32,4 +32,4 @@ filesRouter.post('/deploy', async (req, res) => { }) }) -export default filesRouter +export default driveRouter diff --git a/src/routes/api/index.ts b/src/routes/api/index.ts index 6de05e2..afaa0d6 100644 --- a/src/routes/api/index.ts +++ b/src/routes/api/index.ts @@ -1,10 +1,10 @@ import express from 'express' -import filesRouter from './files' +import driveRouter from './drive' import stpRouter from './stp' const router = express.Router() -router.use('/files', filesRouter) +router.use('/drive', driveRouter) router.use('/stp', stpRouter) export default router diff --git a/src/routes/api/spec/routes.spec.ts b/src/routes/api/spec/drive.spec.ts similarity index 97% rename from src/routes/api/spec/routes.spec.ts rename to src/routes/api/spec/drive.spec.ts index f5bb96c..191db5b 100644 --- a/src/routes/api/spec/routes.spec.ts +++ b/src/routes/api/spec/drive.spec.ts @@ -9,7 +9,7 @@ describe('files', () => { describe('deploy', () => { const shouldFailAssertion = async (payload: any) => { const res = await request(app) - .post('/SASjsApi/files/deploy') + .post('/SASjsApi/drive/deploy') .send(payload) expect(res.statusCode).toEqual(400) @@ -78,7 +78,7 @@ describe('files', () => { it('should respond with payload example if valid payload was not provided', async () => { const res = await request(app) - .post('/SASjsApi/files/deploy') + .post('/SASjsApi/drive/deploy') .send({ fileTree: getTreeExample() }) expect(res.statusCode).toEqual(200)