Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes misspelling of required #136

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/slack/format-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down
8 changes: 4 additions & 4 deletions lib/slack/format-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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');
Expand Down Expand Up @@ -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');
Expand All @@ -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];
}
Expand Down
18 changes: 9 additions & 9 deletions spec/slack/slack-format-dialog-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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', () => {
Expand Down
12 changes: 6 additions & 6 deletions spec/slack/slack-format-message-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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', () => {
Expand All @@ -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', () => {
Expand Down