mirror of
https://github.com/sasjs/server.git
synced 2025-12-10 11:24:35 +00:00
chore(routes): change files route with drive
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user