update Tests
This commit is contained in:
parent
3fc712af8a
commit
df3bf79e2f
44
dist/slackme.classes.slackmessage.d.ts
vendored
44
dist/slackme.classes.slackmessage.d.ts
vendored
@ -1,3 +1,8 @@
|
|||||||
|
export interface IAttachmentField {
|
||||||
|
title: string;
|
||||||
|
value: string;
|
||||||
|
short?: boolean;
|
||||||
|
}
|
||||||
export interface IMessageOptions {
|
export interface IMessageOptions {
|
||||||
/**
|
/**
|
||||||
* "Required plain-text summary of the attachment."
|
* "Required plain-text summary of the attachment."
|
||||||
@ -11,24 +16,35 @@ export interface IMessageOptions {
|
|||||||
* a message to show above
|
* a message to show above
|
||||||
*/
|
*/
|
||||||
pretext?: string;
|
pretext?: string;
|
||||||
"author_name"?: "Bobby Tables";
|
/**
|
||||||
"author_link"?: "http://flickr.com/bobby/";
|
* author name of the attachment
|
||||||
"author_icon"?: "http://flickr.com/icons/bobby.jpg";
|
*/
|
||||||
"title"?: "Slack API Documentation";
|
author_name?: string;
|
||||||
"title_link"?: "https://api.slack.com/";
|
/**
|
||||||
|
* a link to the author
|
||||||
|
*/
|
||||||
|
author_link?: string;
|
||||||
|
/**
|
||||||
|
* a string to the author
|
||||||
|
*/
|
||||||
|
author_icon?: string;
|
||||||
|
/**
|
||||||
|
* a title for the attachment
|
||||||
|
*/
|
||||||
|
title?: string;
|
||||||
|
/**
|
||||||
|
* a link for the title
|
||||||
|
*/
|
||||||
|
title_link?: string;
|
||||||
/**
|
/**
|
||||||
* the main text of the message
|
* the main text of the message
|
||||||
*/
|
*/
|
||||||
text?: string;
|
text?: string;
|
||||||
"fields"?: [{
|
fields?: IAttachmentField[];
|
||||||
"title"?: "Priority";
|
image_url?: string;
|
||||||
"value"?: "High";
|
thumb_url?: string;
|
||||||
"short"?: false;
|
footer?: string;
|
||||||
}];
|
footer_icon?: string;
|
||||||
"image_url"?: "http://my-website.com/path/to/image.jpg";
|
|
||||||
"thumb_url"?: "http://example.com/path/to/thumb.png";
|
|
||||||
"footer"?: "Slack API";
|
|
||||||
"footer_icon"?: "https://platform.slack-edge.com/img/default_application_icon.png";
|
|
||||||
/**
|
/**
|
||||||
* timestamp as epoch time
|
* timestamp as epoch time
|
||||||
*/
|
*/
|
||||||
|
2
dist/slackme.classes.slackmessage.js
vendored
2
dist/slackme.classes.slackmessage.js
vendored
@ -6,4 +6,4 @@ class SlackMessage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.SlackMessage = SlackMessage;
|
exports.SlackMessage = SlackMessage;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2xhY2ttZS5jbGFzc2VzLnNsYWNrbWVzc2FnZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NsYWNrbWUuY2xhc3Nlcy5zbGFja21lc3NhZ2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUF5Q0E7SUFFRSxZQUFZLGNBQStCO1FBQ3pDLElBQUksQ0FBQyxjQUFjLEdBQUcsY0FBYyxDQUFBO0lBQ3RDLENBQUM7Q0FDRjtBQUxELG9DQUtDIn0=
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2xhY2ttZS5jbGFzc2VzLnNsYWNrbWVzc2FnZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NsYWNrbWUuY2xhc3Nlcy5zbGFja21lc3NhZ2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUF3REE7SUFFRSxZQUFZLGNBQStCO1FBQ3pDLElBQUksQ0FBQyxjQUFjLEdBQUcsY0FBYyxDQUFBO0lBQ3RDLENBQUM7Q0FDRjtBQUxELG9DQUtDIn0=
|
19
test/test.ts
19
test/test.ts
@ -13,8 +13,23 @@ tap.test('should create a valid slackme instance', async () => {
|
|||||||
|
|
||||||
tap.test('should send a message to Slack', async () => {
|
tap.test('should send a message to Slack', async () => {
|
||||||
let slackMessage = new slackme.SlackMessage({
|
let slackMessage = new slackme.SlackMessage({
|
||||||
text: 'hi. This is a text',
|
author_name: 'GitLab CI',
|
||||||
color: '#3cb371'
|
author_link: 'https://gitlab.com/',
|
||||||
|
pretext: '*Good News*: Build successfull!',
|
||||||
|
color: '#3cb371',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
title: 'Branch',
|
||||||
|
value: 'Lossless Cloud',
|
||||||
|
short: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Product ID',
|
||||||
|
value: 'pushrocks',
|
||||||
|
short: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
ts: (new Date()).getTime()
|
||||||
})
|
})
|
||||||
testSlackme.sendMessage(slackMessage, 'random')
|
testSlackme.sendMessage(slackMessage, 'random')
|
||||||
})
|
})
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
import * as plugins from './slackme.plugins'
|
import * as plugins from './slackme.plugins'
|
||||||
|
|
||||||
|
export interface IAttachmentField {
|
||||||
|
title: string
|
||||||
|
value: string
|
||||||
|
short?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
export interface IMessageOptions {
|
export interface IMessageOptions {
|
||||||
/**
|
/**
|
||||||
* "Required plain-text summary of the attachment."
|
* "Required plain-text summary of the attachment."
|
||||||
@ -13,26 +19,35 @@ export interface IMessageOptions {
|
|||||||
* a message to show above
|
* a message to show above
|
||||||
*/
|
*/
|
||||||
pretext?: string,
|
pretext?: string,
|
||||||
"author_name"?: "Bobby Tables",
|
/**
|
||||||
"author_link"?: "http://flickr.com/bobby/",
|
* author name of the attachment
|
||||||
"author_icon"?: "http://flickr.com/icons/bobby.jpg",
|
*/
|
||||||
"title"?: "Slack API Documentation",
|
author_name?: string,
|
||||||
"title_link"?: "https://api.slack.com/",
|
/**
|
||||||
|
* a link to the author
|
||||||
|
*/
|
||||||
|
author_link?: string,
|
||||||
|
/**
|
||||||
|
* a string to the author
|
||||||
|
*/
|
||||||
|
author_icon?: string,
|
||||||
|
/**
|
||||||
|
* a title for the attachment
|
||||||
|
*/
|
||||||
|
title?: string,
|
||||||
|
/**
|
||||||
|
* a link for the title
|
||||||
|
*/
|
||||||
|
title_link?: string,
|
||||||
/**
|
/**
|
||||||
* the main text of the message
|
* the main text of the message
|
||||||
*/
|
*/
|
||||||
text?: string,
|
text?: string,
|
||||||
"fields"?: [
|
fields?: IAttachmentField[],
|
||||||
{
|
image_url?: string,
|
||||||
"title"?: "Priority",
|
thumb_url?: string,
|
||||||
"value"?: "High",
|
footer?: string,
|
||||||
"short"?: false
|
footer_icon?: string,
|
||||||
}
|
|
||||||
],
|
|
||||||
"image_url"?: "http://my-website.com/path/to/image.jpg",
|
|
||||||
"thumb_url"?: "http://example.com/path/to/thumb.png",
|
|
||||||
"footer"?: "Slack API",
|
|
||||||
"footer_icon"?: "https://platform.slack-edge.com/img/default_application_icon.png",
|
|
||||||
/**
|
/**
|
||||||
* timestamp as epoch time
|
* timestamp as epoch time
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user