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:
@@ -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
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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)
|
||||||
Reference in New Issue
Block a user