thread_post.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. process.env.NODE_ENV = 'test'
  2. let chai = require('chai')
  3. let server = require('../server')
  4. let should = chai.should()
  5. let { sequelize } = require('../models')
  6. const Errors = require('../lib/errors.js')
  7. chai.use(require('chai-http'))
  8. chai.use(require('chai-things'))
  9. describe('Thread and post', () => {
  10. //Wait for app to start before commencing
  11. before((done) => {
  12. if(server.locals.appStarted) done()
  13. server.on('appStarted', () => {
  14. done()
  15. })
  16. })
  17. //Delete all rows in table after
  18. //tests completed
  19. after(() => {
  20. sequelize.sync({ force: true })
  21. })
  22. describe('POST /thread', () => {
  23. it('should create a thread if logged in', async () => {})
  24. it('should return an error if not logged in', async () => {})
  25. it('should return an error if missing parameters', async () => {})
  26. it('should return an error if invalid types', async () => {})
  27. it('should return an error if category does not exist', async () => {})
  28. })
  29. describe('GET /thread/:id', () => {
  30. it('should return the thread and corresponding posts', async () => {})
  31. it('should return an error if :id is invalid', async () => {})
  32. })
  33. describe('POST /post', () => {
  34. it('should create a post if logged in', async () => {})
  35. it('should return an error if not logged in', async () => {})
  36. it('should return an error if missing parameters', async () => {})
  37. it('should return an error if invalid types', async () => {})
  38. it('should return an error if thread id does not exist', async () => {})
  39. it('should be able to reply to a post', async () => {})
  40. it('should return an error if reply id does not exist', async () => {})
  41. it('should return an error if post reply not in same thread', async () => {})
  42. })
  43. describe('GET /post/:id', () => {
  44. it('should return the post', async () => {})
  45. it('should return an error if invalid post id', async () => {})
  46. })
  47. })