fix(core): update
This commit is contained in:
32
test/test.ts
32
test/test.ts
@ -8,11 +8,11 @@ import * as slackme from '../ts/index';
|
||||
let testSlackme: slackme.Slackme;
|
||||
let testSlackMessage: slackme.SlackMessage;
|
||||
|
||||
tap.test('should create a valid slackme instance', async () => {
|
||||
tap.test('should create a valid slackme instance', async (tools) => {
|
||||
testSlackme = new slackme.Slackme(testQenv.getEnvVarOnDemand('SLACK_TOKEN'));
|
||||
});
|
||||
|
||||
tap.test('should send a message to Slack', async () => {
|
||||
tap.test('should send a message to Slack', async (tools) => {
|
||||
testSlackMessage = new slackme.SlackMessage({
|
||||
author_name: 'GitLab CI',
|
||||
author_link: 'https://gitlab.com/',
|
||||
@ -29,14 +29,12 @@ tap.test('should send a message to Slack', async () => {
|
||||
value: 'pushrocks',
|
||||
short: true
|
||||
}
|
||||
],
|
||||
ts: new Date().getTime() / 1000
|
||||
]
|
||||
});
|
||||
await testSlackme.sendMessage(testSlackMessage.messageOptions, 'random');
|
||||
await expect(testSlackMessage.sendToRoom('random')).to.eventually.be.rejected;
|
||||
});
|
||||
|
||||
tap.test('should send a message to Slack by directly calling the message', async () => {
|
||||
tap.test('should send a message to Slack by directly calling the message', async (tools) => {
|
||||
testSlackMessage = new slackme.SlackMessage(
|
||||
{
|
||||
author_name: 'GitLab CI',
|
||||
@ -54,12 +52,30 @@ tap.test('should send a message to Slack by directly calling the message', async
|
||||
value: 'pushrocks',
|
||||
short: true
|
||||
}
|
||||
],
|
||||
ts: new Date().getTime() / 1000
|
||||
]
|
||||
},
|
||||
testSlackme
|
||||
);
|
||||
await testSlackMessage.sendToRoom('random');
|
||||
await tools.delayFor(5000);
|
||||
await testSlackMessage.updateAndSend({
|
||||
author_name: 'GitLab CI',
|
||||
author_link: 'https://gitlab.com/',
|
||||
pretext: '*Good News*: Build successfull!',
|
||||
color: '#3cb371',
|
||||
fields: [
|
||||
{
|
||||
title: 'Branch',
|
||||
value: 'Lossless Studio',
|
||||
short: true
|
||||
},
|
||||
{
|
||||
title: 'Product ID',
|
||||
value: 'pushrocks',
|
||||
short: true
|
||||
}
|
||||
]
|
||||
})
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
Reference in New Issue
Block a user