s.sendActionToClient(c,"You have not been an established chat participant long enough to take part in chat. Please enjoy the stream and try again later.")
@ -52,7 +54,7 @@ test('can derive display name from user header', async (done) => {
@@ -52,7 +54,7 @@ test('can derive display name from user header', async (done) => {
test('can overwrite user header derived display name with body',async(done)=>{
body:'this message should fail to send '+Math.floor(Math.random()*100),
type:'CHAT',
};
test('can send a chat message',async(done)=>{
constregistration=awaitregisterChat();
constaccessToken=registration.accessToken;
@ -30,14 +36,14 @@ test('verify we can make API call to mark message as hidden', async (done) => {
@@ -30,14 +36,14 @@ test('verify we can make API call to mark message as hidden', async (done) => {
);
// Verify the visibility change comes through the websocket
ws.on('message',functionincoming(message){
ws.on('message',asyncfunctionincoming(message){
constmessages=message.split('\n');
messages.forEach(function(message){
messages.forEach(asyncfunction(message){
constevent=JSON.parse(message);
if(event.type==='VISIBILITY-UPDATE'){
done();
ws.close();
done();
}
});
});
@ -48,7 +54,7 @@ test('verify we can make API call to mark message as hidden', async (done) => {
@@ -48,7 +54,7 @@ test('verify we can make API call to mark message as hidden', async (done) => {
.expect(200);
constmessage=res.body[0];
constmessageId=message.id;
messageId=message.id;
awaitrequest
.post('/api/admin/chat/updatemessagevisibility')
.auth('admin','abc123')
@ -57,15 +63,56 @@ test('verify we can make API call to mark message as hidden', async (done) => {
@@ -57,15 +63,56 @@ test('verify we can make API call to mark message as hidden', async (done) => {
});
test('verify message has become hidden',async(done)=>{
awaitnewPromise((r)=>setTimeout(r,2000));
constres=awaitrequest
.get('/api/admin/chat/messages')
.expect(200)
.auth('admin','abc123');
constmessage=res.body.filter((obj)=>{
returnobj.body===`${testVisibilityMessage.body}`;
returnobj.id===messageId;
});
expect(message.length).toBe(1);
// expect(message[0].hiddenAt).toBeTruthy();
done();
});
test('can enable established chat user mode',async(done)=>{