mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 10:23:46 -05:00
31 lines
1.1 KiB
CoffeeScript
31 lines
1.1 KiB
CoffeeScript
{ObjectId} = require "../../../app/js/mongojs"
|
|
expect = require("chai").expect
|
|
crypto = require "crypto"
|
|
|
|
ChatClient = require "./helpers/ChatClient"
|
|
ChatApp = require "./helpers/ChatApp"
|
|
|
|
describe "Deleting a thread", ->
|
|
before (done) ->
|
|
@project_id = ObjectId().toString()
|
|
@user_id = ObjectId().toString()
|
|
ChatApp.ensureRunning done
|
|
|
|
describe "with a thread that is deleted", ->
|
|
before (done) ->
|
|
@thread_id = ObjectId().toString()
|
|
@content = "deleted thread message"
|
|
ChatClient.sendMessage @project_id, @thread_id, @user_id, @content, (error, response, body) =>
|
|
expect(error).to.be.null
|
|
expect(response.statusCode).to.equal 201
|
|
ChatClient.deleteThread @project_id, @thread_id, (error, response, body) =>
|
|
expect(error).to.be.null
|
|
expect(response.statusCode).to.equal 204
|
|
done()
|
|
|
|
it "should then not list the thread for the project", (done) ->
|
|
ChatClient.getThreads @project_id, (error, response, threads) =>
|
|
expect(error).to.be.null
|
|
expect(response.statusCode).to.equal 200
|
|
expect(Object.keys(threads).length).to.equal 0
|
|
done()
|