@@ -28,7 +28,7 @@ function dropDB(done) {
28
28
} ) ;
29
29
}
30
30
31
- describe ( 'GET /api/getPosts ' , function ( ) {
31
+ describe ( 'GET /api/posts ' , function ( ) {
32
32
33
33
beforeEach ( 'connect and add two post entries' , function ( done ) {
34
34
@@ -49,7 +49,7 @@ describe('GET /api/getPosts', function () {
49
49
it ( 'Should correctly give number of Posts' , function ( done ) {
50
50
51
51
request ( app )
52
- . get ( '/api/getPosts ' )
52
+ . get ( '/api/posts ' )
53
53
. set ( 'Accept' , 'application/json' )
54
54
. end ( function ( err , res ) {
55
55
Post . find ( ) . exec ( function ( err , posts ) {
@@ -60,7 +60,7 @@ describe('GET /api/getPosts', function () {
60
60
} ) ;
61
61
} ) ;
62
62
63
- describe ( 'GET /api/getPost ' , function ( ) {
63
+ describe ( 'GET /api/posts/:slug ' , function ( ) {
64
64
65
65
beforeEach ( 'connect and add one Post entry' , function ( done ) {
66
66
@@ -80,7 +80,7 @@ describe('GET /api/getPost', function () {
80
80
it ( 'Should send correct data when queried against a title' , function ( done ) {
81
81
82
82
request ( app )
83
- . get ( '/api/getPost?slug= bar-f34gb2bh24b24b2' )
83
+ . get ( '/api/posts/ bar-f34gb2bh24b24b2' )
84
84
. set ( 'Accept' , 'application/json' )
85
85
. end ( function ( err , res ) {
86
86
Post . findOne ( { cuid : 'f34gb2bh24b24b2' } ) . exec ( function ( err , post ) {
@@ -92,7 +92,7 @@ describe('GET /api/getPost', function () {
92
92
93
93
} ) ;
94
94
95
- describe ( 'POST /api/addPost ' , function ( ) {
95
+ describe ( 'POST /api/posts ' , function ( ) {
96
96
97
97
beforeEach ( 'connect and add a post' , function ( done ) {
98
98
@@ -108,7 +108,7 @@ describe('POST /api/addPost', function () {
108
108
it ( 'Should send correctly add a post' , function ( done ) {
109
109
110
110
request ( app )
111
- . post ( '/api/addPost ' )
111
+ . post ( '/api/posts ' )
112
112
. send ( { post : { name : 'Foo' , title : 'bar' , content : 'Hello Mern says Foo' } } )
113
113
. set ( 'Accept' , 'application/json' )
114
114
. end ( function ( err , res ) {
@@ -121,7 +121,7 @@ describe('POST /api/addPost', function () {
121
121
122
122
} ) ;
123
123
124
- describe ( 'POST /api/deletePost ' , function ( ) {
124
+ describe ( 'POST /api/posts ' , function ( ) {
125
125
var postId ;
126
126
127
127
beforeEach ( 'connect and add one Post entry' , function ( done ) {
@@ -148,8 +148,8 @@ describe('POST /api/deletePost', function () {
148
148
} ) ;
149
149
150
150
request ( app )
151
- . post ( '/api/deletePost ' )
152
- . send ( { postId : postId } )
151
+ . delete ( '/api/posts ' )
152
+ . send ( { id : postId } )
153
153
. set ( 'Accept' , 'application/json' )
154
154
. end ( function ( ) {
155
155
0 commit comments