update Tests

This commit is contained in:
Philipp Kunz 2017-09-17 15:25:00 +02:00
parent 3fc712af8a
commit df3bf79e2f
4 changed files with 79 additions and 33 deletions

View File

@ -1,3 +1,8 @@
export interface IAttachmentField {
title: string;
value: string;
short?: boolean;
}
export interface IMessageOptions {
/**
* "Required plain-text summary of the attachment."
@ -11,24 +16,35 @@ export interface IMessageOptions {
* a message to show above
*/
pretext?: string;
"author_name"?: "Bobby Tables";
"author_link"?: "http://flickr.com/bobby/";
"author_icon"?: "http://flickr.com/icons/bobby.jpg";
"title"?: "Slack API Documentation";
"title_link"?: "https://api.slack.com/";
/**
* author name of the attachment
*/
author_name?: string;
/**
* 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
*/
text?: string;
"fields"?: [{
"title"?: "Priority";
"value"?: "High";
"short"?: false;
}];
"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";
fields?: IAttachmentField[];
image_url?: string;
thumb_url?: string;
footer?: string;
footer_icon?: string;
/**
* timestamp as epoch time
*/

View File

@ -6,4 +6,4 @@ class SlackMessage {
}
}
exports.SlackMessage = SlackMessage;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2xhY2ttZS5jbGFzc2VzLnNsYWNrbWVzc2FnZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NsYWNrbWUuY2xhc3Nlcy5zbGFja21lc3NhZ2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUF5Q0E7SUFFRSxZQUFZLGNBQStCO1FBQ3pDLElBQUksQ0FBQyxjQUFjLEdBQUcsY0FBYyxDQUFBO0lBQ3RDLENBQUM7Q0FDRjtBQUxELG9DQUtDIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2xhY2ttZS5jbGFzc2VzLnNsYWNrbWVzc2FnZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NsYWNrbWUuY2xhc3Nlcy5zbGFja21lc3NhZ2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUF3REE7SUFFRSxZQUFZLGNBQStCO1FBQ3pDLElBQUksQ0FBQyxjQUFjLEdBQUcsY0FBYyxDQUFBO0lBQ3RDLENBQUM7Q0FDRjtBQUxELG9DQUtDIn0=

View File

@ -13,8 +13,23 @@ tap.test('should create a valid slackme instance', async () => {
tap.test('should send a message to Slack', async () => {
let slackMessage = new slackme.SlackMessage({
text: 'hi. This is a text',
color: '#3cb371'
author_name: 'GitLab CI',
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')
})

View File

@ -1,5 +1,11 @@
import * as plugins from './slackme.plugins'
export interface IAttachmentField {
title: string
value: string
short?: boolean
}
export interface IMessageOptions {
/**
* "Required plain-text summary of the attachment."
@ -13,26 +19,35 @@ export interface IMessageOptions {
* a message to show above
*/
pretext?: string,
"author_name"?: "Bobby Tables",
"author_link"?: "http://flickr.com/bobby/",
"author_icon"?: "http://flickr.com/icons/bobby.jpg",
"title"?: "Slack API Documentation",
"title_link"?: "https://api.slack.com/",
/**
* author name of the attachment
*/
author_name?: string,
/**
* 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
*/
text?: string,
"fields"?: [
{
"title"?: "Priority",
"value"?: "High",
"short"?: false
}
],
"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",
fields?: IAttachmentField[],
image_url?: string,
thumb_url?: string,
footer?: string,
footer_icon?: string,
/**
* timestamp as epoch time
*/