Explorar o código

Add test for deleting reports after deleting thread

sbkwgh %!s(int64=7) %!d(string=hai) anos
pai
achega
ee79ce094c
Modificáronse 1 ficheiros con 18 adicións e 0 borrados
  1. 18 0
      test/delete_thread.js

+ 18 - 0
test/delete_thread.js

@@ -78,6 +78,22 @@ describe('Thread', () => {
 						threadId: 1
 					})
 
+				await user
+					.post('/api/v1/report')
+					.set('content-type', 'application/json')
+					.send({
+						postId: 1,
+						reason: 'inappropriate'
+					})
+
+				await user
+					.post('/api/v1/report')
+					.set('content-type', 'application/json')
+					.send({
+						postId: 2,
+						reason: 'inappropriate'
+					})
+
 				return true
 			} catch (e) {
 				return e
@@ -95,9 +111,11 @@ describe('Thread', () => {
 					ThreadId: 1
 				}
 			})
+			let reports = await admin.get('/api/v1/report')
 
 			expect(thread).to.be.null
 			expect(posts).to.have.property('length', 0)
+			expect(reports.body).to.have.property('length', 0)
 		})
 		it('should return an error if thread does not exist', done => {
 			admin