Commit e2a1d4f7 authored by arcter's avatar arcter
Browse files

Delete added

parent 3515ad79
Pipeline #4687 failed with stages
in 3 minutes and 48 seconds
......@@ -3,7 +3,6 @@ const session = require('supertest-session')
const { merge, has } = require('lodash')
const { validateKeys } = require('../../../utils/testHelpers')
const { User } = require('../../user/userModel')
const { News } = require('../newsModel')
const endpointUrl = '/api/v1/news'
const fakeUserJson = {
......@@ -55,7 +54,6 @@ let fakeNewsJson={
})})
// Create
test(`Create news`, async () => {
const ownUser = await authSession.get('/api/v1/extra/me')
const newNews = await News.create(fakeNewsJson)
let response =await authSession.post(`${endpointUrl}/`).send({
title:newNews.title,
......@@ -77,6 +75,12 @@ let fakeNewsJson={
expect(response.statusCode).toBe(200)
expect(response.body.data.title).toBe('updatedtitle')
})
//Delete
test(`Delete news`,async ()=>{
const newNews = await News.create(fakeNewsJson)
let response=await authSession.delete(`${endpointUrl}/${newNews._id}`)
expect(response.statusCode).toBe(200)
})
})
describe('/news "Accepted" Functionality',()=>{
let authSession
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment