chore: cleanup, ci workflows and formatting (#127064)
* ci: setup workflows, dependabot, labeler and commit linting * docs: update README, community files and issue templates * chore: configure prettier, editorconfig and format codebase * chore: restore changes lost during rebase * docs: adjust url for new logo * fix: align badges * chore: resolve conflicts and re-add temp lint
This commit is contained in:
parent
c2d978fd0a
commit
807efd502d
1 changed files with 6790 additions and 3547 deletions
|
|
@ -11,7 +11,7 @@ describe('Chat', function () {
|
|||
let client;
|
||||
let chat;
|
||||
|
||||
before(async function() {
|
||||
before(async function () {
|
||||
this.timeout(35000);
|
||||
client = helper.createClient({ authenticated: true });
|
||||
await client.initialize();
|
||||
|
|
@ -39,7 +39,7 @@ describe('Chat', function () {
|
|||
const messages = await chat.fetchMessages();
|
||||
expect(messages.length).to.be.greaterThanOrEqual(2);
|
||||
|
||||
const fetchedMsg = messages[messages.length-1];
|
||||
const fetchedMsg = messages[messages.length - 1];
|
||||
expect(fetchedMsg).to.be.instanceOf(Message);
|
||||
expect(fetchedMsg.type).to.equal(MessageTypes.TEXT);
|
||||
expect(fetchedMsg.id._serialized).to.equal(msg.id._serialized);
|
||||
|
|
@ -47,11 +47,11 @@ describe('Chat', function () {
|
|||
});
|
||||
|
||||
it('can use a limit when fetching messages sent in a chat', async function () {
|
||||
await helper.sleep(1000);
|
||||
await helper.sleep(1000);
|
||||
const msg = await chat.sendMessage('yet another message');
|
||||
await helper.sleep(500);
|
||||
|
||||
const messages = await chat.fetchMessages({limit: 1});
|
||||
const messages = await chat.fetchMessages({ limit: 1 });
|
||||
expect(messages).to.have.lengthOf(1);
|
||||
|
||||
const fetchedMsg = messages[0];
|
||||
|
|
@ -62,12 +62,12 @@ describe('Chat', function () {
|
|||
});
|
||||
|
||||
it('can use fromMe=true when fetching messages sent in a chat to get only bot messages', async function () {
|
||||
const messages = await chat.fetchMessages({fromMe: true});
|
||||
const messages = await chat.fetchMessages({ fromMe: true });
|
||||
expect(messages).to.have.lengthOf(2);
|
||||
});
|
||||
|
||||
it('can use fromMe=false when fetching messages sent in a chat to get only non bot messages', async function () {
|
||||
const messages = await chat.fetchMessages({fromMe: false});
|
||||
const messages = await chat.fetchMessages({ fromMe: false });
|
||||
expect(messages).to.have.lengthOf(0);
|
||||
});
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ describe('Chat', function () {
|
|||
});
|
||||
});
|
||||
|
||||
describe('Archiving', function (){
|
||||
describe('Archiving', function () {
|
||||
it('can archive a chat', async function () {
|
||||
const res = await chat.archive();
|
||||
expect(res).to.equal(true);
|
||||
|
|
@ -147,7 +147,7 @@ describe('Chat', function () {
|
|||
});
|
||||
|
||||
describe('Muting', function () {
|
||||
it('can mute a chat forever', async function() {
|
||||
it('can mute a chat forever', async function () {
|
||||
await chat.mute();
|
||||
|
||||
await helper.sleep(1000);
|
||||
|
|
@ -158,8 +158,8 @@ describe('Chat', function () {
|
|||
expect(chat.muteExpiration).to.equal(-1);
|
||||
});
|
||||
|
||||
it('can mute a chat until a specific date', async function() {
|
||||
const unmuteDate = new Date(new Date().getTime() + (1000*60*60));
|
||||
it('can mute a chat until a specific date', async function () {
|
||||
const unmuteDate = new Date(new Date().getTime() + 1000 * 60 * 60);
|
||||
await chat.mute(unmuteDate);
|
||||
|
||||
await helper.sleep(1000);
|
||||
|
|
@ -168,36 +168,36 @@ describe('Chat', function () {
|
|||
chat = await client.getChatById(remoteId);
|
||||
expect(chat.isMuted).to.equal(true);
|
||||
expect(chat.muteExpiration).to.equal(
|
||||
Math.round(unmuteDate.getTime() / 1000)
|
||||
Math.round(unmuteDate.getTime() / 1000),
|
||||
);
|
||||
});
|
||||
|
||||
it('can unmute a chat', async function () {
|
||||
await chat.unmute();
|
||||
await helper.sleep(500);
|
||||
|
||||
|
||||
// refresh chat
|
||||
chat = await client.getChatById(remoteId);
|
||||
expect(chat.isMuted).to.equal(false);
|
||||
expect(chat.muteExpiration).to.equal(0);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// eslint-disable-next-line mocha/no-skipped-tests
|
||||
describe.skip('Destructive operations', function () {
|
||||
it('can clear all messages from chat', async function () {
|
||||
it('can clear all messages from chat', async function () {
|
||||
const res = await chat.clearMessages();
|
||||
expect(res).to.equal(true);
|
||||
|
||||
|
||||
await helper.sleep(3000);
|
||||
|
||||
|
||||
const msgs = await chat.fetchMessages();
|
||||
expect(msgs).to.have.lengthOf(0);
|
||||
});
|
||||
|
||||
|
||||
it('can delete a chat', async function () {
|
||||
const res = await chat.delete();
|
||||
expect(res).to.equal(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue