فهرست منبع

Implement test skeleton

sbkwgh 8 سال پیش
والد
کامیت
a938f97baf
1فایلهای تغییر یافته به همراه32 افزوده شده و 0 حذف شده
  1. 32 0
      test/thread_post.js

+ 32 - 0
test/thread_post.js

@@ -14,6 +14,8 @@ chai.use(require('chai-things'))
 describe('Thread and post', () => {
 	//Wait for app to start before commencing
 	before((done) => {
+		if(server.locals.appStarted) done()
+
 		server.on('appStarted', () => {
 			done()
 		})
@@ -24,4 +26,34 @@ describe('Thread and post', () => {
 	after(() => {
 		sequelize.sync({ force: true })
 	})
+
+	describe('POST /thread', () => {
+		it('should create a thread if logged in', async () => {})
+		it('should return an error if not logged in', async () => {})
+		it('should return an error if missing parameters', async () => {})
+		it('should return an error if invalid types', async () => {})
+		it('should return an error if category does not exist', async () => {})
+	})
+
+	describe('GET /thread/:id', () => {
+		it('should return the thread and corresponding posts', async () => {})
+		it('should return an error if :id is invalid', async () => {})
+	})
+
+	describe('POST /post', () => {
+		it('should create a post if logged in', async () => {})
+		it('should return an error if not logged in', async () => {})
+		it('should return an error if missing parameters', async () => {})
+		it('should return an error if invalid types', async () => {})
+		it('should return an error if thread id does not exist', async () => {})
+
+		it('should be able to reply to a post', async () => {})
+		it('should return an error if reply id does not exist', async () => {})
+		it('should return an error if post reply not in same thread', async () => {})
+	})
+
+	describe('GET /post/:id', () => {
+		it('should return the post', async () => {})
+		it('should return an error if invalid post id', async () => {})
+	})
 })