diff --git a/lib/slack/format-dialog.js b/lib/slack/format-dialog.js index e2fb9a5..abb9e02 100644 --- a/lib/slack/format-dialog.js +++ b/lib/slack/format-dialog.js @@ -3,7 +3,7 @@ class SlackDialog { constructor(token, triggerId, title, submitLabel, callbackId, notifyOnCancel = false) { if (!token || !triggerId || !title) - throw new Error('token, triggerId and title are requeired for dialog.open method'); + throw new Error('token, triggerId and title are required for dialog.open method'); if (title.length > 24) throw new Error('Title needs to be less or equal to 24 characters'); @@ -44,7 +44,7 @@ class SlackDialog { throw new Error('You can not add more than 5 elements'); if (!text || !name) - throw new Error('Text and name are requeired for addInput method'); + throw new Error('Text and name are required for addInput method'); if (text.length > 24) throw new Error('Text needs to be less or equal to 24 characters'); @@ -104,7 +104,7 @@ class SlackDialog { throw new Error('You can not add more than 5 elements'); if (!text || !name) - throw new Error('Text and name are requeired for addTextarea method'); + throw new Error('Text and name are required for addTextarea method'); if (text.length > 24) throw new Error('Text needs to be less or equal to 24 characters'); @@ -165,7 +165,7 @@ class SlackDialog { throw new Error('You can not add more than 5 elements'); if (!text || !name) - throw new Error('Text and name are requeired for addSelect method'); + throw new Error('Text and name are required for addSelect method'); if (text.length > 24) throw new Error('Text needs to be less or equal to 24 characters'); diff --git a/lib/slack/format-message.js b/lib/slack/format-message.js index 4ae5169..edb8e8c 100644 --- a/lib/slack/format-message.js +++ b/lib/slack/format-message.js @@ -181,7 +181,7 @@ class SlackTemplate { throw new Error('You can not add more than 5 actions'); if (!text || !name || !value) - throw new Error('Text, name and value are requeired for addAction method'); + throw new Error('Text, name and value are required for addAction method'); const action = { text: text, @@ -203,7 +203,7 @@ class SlackTemplate { throw new Error('You can not add more than 5 actions'); if (!text || !name) - throw new Error('Text and name are requeired for addAction method'); + throw new Error('Text and name are required for addAction method'); if (name.split(' ').length > 1) throw new Error('Name need to be one word'); @@ -243,7 +243,7 @@ class SlackTemplate { throw new Error('You can not add more than 5 actions and link buttons'); if (!text || !url) - throw new Error('Text and URL are requeired for addLinkButton method'); + throw new Error('Text and URL are required for addLinkButton method'); if (!isUrl(url)) throw new Error('URL need to be a valid'); @@ -266,7 +266,7 @@ class SlackTemplate { const actions = this.getLatestAttachment().actions; if (!actions.length) - throw new Error('At least one action is requeired for getLatestAction method'); + throw new Error('At least one action is required for getLatestAction method'); return actions[actions.length - 1]; } diff --git a/spec/slack/slack-format-dialog-spec.js b/spec/slack/slack-format-dialog-spec.js index 1dbd650..9b68735 100644 --- a/spec/slack/slack-format-dialog-spec.js +++ b/spec/slack/slack-format-dialog-spec.js @@ -21,15 +21,15 @@ describe('Slack format dialog', () => { }); it('should throw an error if you don\'t provide token in the constructor', () => { - expect(() => new formatSlackDialog()).toThrowError('token, triggerId and title are requeired for dialog.open method'); + expect(() => new formatSlackDialog()).toThrowError('token, triggerId and title are required for dialog.open method'); }); it('should throw an error if you don\'t provide triggerId in the constructor', () => { - expect(() => new formatSlackDialog()).toThrowError('token, triggerId and title are requeired for dialog.open method'); + expect(() => new formatSlackDialog()).toThrowError('token, triggerId and title are required for dialog.open method'); }); it('should throw an error if you don\'t provide title in the constructor', () => { - expect(() => new formatSlackDialog()).toThrowError('token, triggerId and title are requeired for dialog.open method'); + expect(() => new formatSlackDialog()).toThrowError('token, triggerId and title are required for dialog.open method'); }); it('should add token, triggerId and title if you provide it in the constructor', () => { @@ -85,11 +85,11 @@ describe('Slack format dialog', () => { describe('addInput', () => { it('should throw an error if you use without adding a title', () => { - expect(() => message.addInput()).toThrowError('Text and name are requeired for addInput method'); + expect(() => message.addInput()).toThrowError('Text and name are required for addInput method'); }); it('should throw an error if you use without adding a name', () => { - expect(() => message.addInput('title')).toThrowError('Text and name are requeired for addInput method'); + expect(() => message.addInput('title')).toThrowError('Text and name are required for addInput method'); }); it('should throw an error if you use with text more than 24 characters', () => { @@ -214,11 +214,11 @@ describe('Slack format dialog', () => { describe('addTextarea', () => { it('should throw an error if you use without adding a title', () => { - expect(() => message.addTextarea()).toThrowError('Text and name are requeired for addTextarea method'); + expect(() => message.addTextarea()).toThrowError('Text and name are required for addTextarea method'); }); it('should throw an error if you use without adding a name', () => { - expect(() => message.addTextarea('title')).toThrowError('Text and name are requeired for addTextarea method'); + expect(() => message.addTextarea('title')).toThrowError('Text and name are required for addTextarea method'); }); it('should throw an error if you use with text more than 24 characters', () => { @@ -338,11 +338,11 @@ describe('Slack format dialog', () => { describe('addSelect', () => { it('should throw an error if you use without adding a title', () => { - expect(() => message.addSelect()).toThrowError('Text and name are requeired for addSelect method'); + expect(() => message.addSelect()).toThrowError('Text and name are required for addSelect method'); }); it('should throw an error if you use without adding a name', () => { - expect(() => message.addSelect('title')).toThrowError('Text and name are requeired for addSelect method'); + expect(() => message.addSelect('title')).toThrowError('Text and name are required for addSelect method'); }); it('should throw an error if you use with text more than 24 characters', () => { diff --git a/spec/slack/slack-format-message-spec.js b/spec/slack/slack-format-message-spec.js index 640a2fd..0502cd5 100644 --- a/spec/slack/slack-format-message-spec.js +++ b/spec/slack/slack-format-message-spec.js @@ -208,7 +208,7 @@ describe('Slack format message', () => { it('should throw an error if you addAction without valid data', () => { const message = new formatSlackMessage().addAttachment(); - expect(() => message.addAction()).toThrowError('Text, name and value are requeired for addAction method'); + expect(() => message.addAction()).toThrowError('Text, name and value are required for addAction method'); }); it('should add an action', () => { @@ -251,12 +251,12 @@ describe('Slack format message', () => { it('should throw an error if you addSelect without valid data', () => { const message = new formatSlackMessage().addAttachment(); - expect(() => message.addSelect()).toThrowError('Text and name are requeired for addAction method'); + expect(() => message.addSelect()).toThrowError('Text and name are required for addAction method'); }); it('should throw an error if you addSelect without valid data', () => { const message = new formatSlackMessage().addAttachment(); - expect(() => message.addSelect()).toThrowError('Text and name are requeired for addAction method'); + expect(() => message.addSelect()).toThrowError('Text and name are required for addAction method'); }); it('should throw an error if you addSelect with name with two or more words', () => { @@ -343,12 +343,12 @@ describe('Slack format message', () => { it('should throw an error if you addLinkButton without valid data', () => { const message = new formatSlackMessage().addAttachment(); - expect(() => message.addLinkButton()).toThrowError('Text and URL are requeired for addLinkButton method'); + expect(() => message.addLinkButton()).toThrowError('Text and URL are required for addLinkButton method'); }); it('should throw an error if you addLinkButton without valid data', () => { const message = new formatSlackMessage().addAttachment(); - expect(() => message.addLinkButton('Button name')).toThrowError('Text and URL are requeired for addLinkButton method'); + expect(() => message.addLinkButton('Button name')).toThrowError('Text and URL are required for addLinkButton method'); }); it('should throw an error if you addLinkButton without valid data', () => { @@ -368,7 +368,7 @@ describe('Slack format message', () => { it('should throw an error if you try to add confirmation before adding an action', () => { const message = new formatSlackMessage().addAttachment(); - expect(() => message.addConfirmation()).toThrowError('At least one action is requeired for getLatestAction method'); + expect(() => message.addConfirmation()).toThrowError('At least one action is required for getLatestAction method'); }); it('should throw an error if you try to add confirmation without valid data', () => {