1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-15 01:40:05 +00:00

chore(routes): change files route with drive

This commit is contained in:
Yury Shkoda
2021-10-28 12:09:19 +00:00
parent 49c152a398
commit 48fe7994ec
3 changed files with 7 additions and 7 deletions

View File

@@ -2,9 +2,9 @@ import express from 'express'
import { createFileTree, getTreeExample } from '../../controllers' import { createFileTree, getTreeExample } from '../../controllers'
import { isFileTree } from '../../types' 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)) { if (!isFileTree(req.body.fileTree)) {
res.status(400).send({ res.status(400).send({
status: 'failure', status: 'failure',
@@ -32,4 +32,4 @@ filesRouter.post('/deploy', async (req, res) => {
}) })
}) })
export default filesRouter export default driveRouter

View File

@@ -1,10 +1,10 @@
import express from 'express' import express from 'express'
import filesRouter from './files' import driveRouter from './drive'
import stpRouter from './stp' import stpRouter from './stp'
const router = express.Router() const router = express.Router()
router.use('/files', filesRouter) router.use('/drive', driveRouter)
router.use('/stp', stpRouter) router.use('/stp', stpRouter)
export default router export default router

View File

@@ -9,7 +9,7 @@ describe('files', () => {
describe('deploy', () => { describe('deploy', () => {
const shouldFailAssertion = async (payload: any) => { const shouldFailAssertion = async (payload: any) => {
const res = await request(app) const res = await request(app)
.post('/SASjsApi/files/deploy') .post('/SASjsApi/drive/deploy')
.send(payload) .send(payload)
expect(res.statusCode).toEqual(400) expect(res.statusCode).toEqual(400)
@@ -78,7 +78,7 @@ describe('files', () => {
it('should respond with payload example if valid payload was not provided', async () => { it('should respond with payload example if valid payload was not provided', async () => {
const res = await request(app) const res = await request(app)
.post('/SASjsApi/files/deploy') .post('/SASjsApi/drive/deploy')
.send({ fileTree: getTreeExample() }) .send({ fileTree: getTreeExample() })
expect(res.statusCode).toEqual(200) expect(res.statusCode).toEqual(200)