Skip to content
Snippets Groups Projects
Verified Commit 2b9b664e authored by aguestuser's avatar aguestuser
Browse files

[99] parse ACCEPT & DECLINE commands

parent 7619dc0a
Branches
No related tags found
No related merge requests found
...@@ -12,6 +12,8 @@ const toggles = { ...@@ -12,6 +12,8 @@ const toggles = {
const commands = { const commands = {
ADD: 'ADD', ADD: 'ADD',
ACCEPT: 'ACCEPT',
DECLINE: 'DECLINE',
HELP: 'HELP', HELP: 'HELP',
INFO: 'INFO', INFO: 'INFO',
INVITE: 'INVITE', INVITE: 'INVITE',
......
module.exports = { module.exports = {
ADD: ['ADD'], ADD: ['ADD'],
ACCEPT: ['ACCEPT'],
DECLINE: ['DECLINE'],
HELP: ['HELP'], HELP: ['HELP'],
INFO: ['INFO'], INFO: ['INFO'],
INVITE: ['INVITE'], INVITE: ['INVITE'],
......
module.exports = { module.exports = {
ADD: ['AGREGAR'], ADD: ['AGREGAR'],
ACCEPT: ['ACEPTAR'],
DECLINE: ['RECHAZAR'],
HELP: ['AYUDA'], HELP: ['AYUDA'],
INFO: ['INFO'], INFO: ['INFO'],
INVITE: ['INVITAR'], INVITE: ['INVITAR'],
......
module.exports = { module.exports = {
ADD: ['AJOUTER'], ADD: ['AJOUTER'],
ACCEPT: ['ACCEPTER'],
DECLINE: ['REFUSER'],
HELP: ['AIDE'], HELP: ['AIDE'],
INFO: ['INFO'], INFO: ['INFO'],
INVITE: ['INVITER'], INVITE: ['INVITER'],
......
...@@ -11,6 +11,8 @@ describe('parsing commands', () => { ...@@ -11,6 +11,8 @@ describe('parsing commands', () => {
const msgs = [ const msgs = [
'fire the missiles', 'fire the missiles',
'the ADD foo', 'the ADD foo',
'the ACCEPT',
'the DECLINE',
'the REMOVE foo', 'the REMOVE foo',
'the HELP', 'the HELP',
'the INFO', 'the INFO',
...@@ -19,21 +21,27 @@ describe('parsing commands', () => { ...@@ -19,21 +21,27 @@ describe('parsing commands', () => {
'the GOODBYE', 'the GOODBYE',
'the RESPONSES ON', 'the RESPONSES ON',
'the RESPONSES OFF', 'the RESPONSES OFF',
'the VOUCHING ON',
'the VOUCHING OFF',
'the ENGLISH', 'the ENGLISH',
'la AGREGAR foo', 'la AGREGAR foo',
'la ACEPTAR',
'la AYUDA', 'la AYUDA',
'la INFO', 'la INFO',
'la INVITAR', 'la INVITAR',
'la HOLA', 'la HOLA',
'la ADIÓS', 'la ADIÓS',
'la ELIMINAR', 'la ELIMINAR',
'la RECHAZAR',
'la RENOMBRAR', 'la RENOMBRAR',
'la RESPUESTAS ACTIVADAS', 'la RESPUESTAS ACTIVADAS',
'la RESPUESTAS DESACTIVADAS', 'la RESPUESTAS DESACTIVADAS',
'la ESPAÑOL', 'la ESPAÑOL',
'le AJOUTER', 'le AJOUTER',
'le ACCEPTER',
'le REFUSER',
'le AIDE', 'le AIDE',
'le INFO', 'le INFO',
'le INVITER', 'le INVITER',
...@@ -57,6 +65,34 @@ describe('parsing commands', () => { ...@@ -57,6 +65,34 @@ describe('parsing commands', () => {
}) })
}) })
describe('ACCEPT command', () => {
it('parses an ACCEPT command regardless of casing, spacing, accents, or language', () => {
const variants = [
{
language: languages.EN,
messages: ['ACCEPT', ' accept '],
},
{
language: languages.ES,
messages: ['ACEPTAR', ' aceptar '],
},
{
language: languages.FR,
messages: ['ACCEPTER', ' accepter '],
},
]
variants.forEach(({ language, messages }) =>
messages.forEach(msg =>
expect(parseExecutable(msg)).to.eql({
command: commands.ACCEPT,
language,
payload: '',
}),
),
)
})
})
describe('ADD command', () => { describe('ADD command', () => {
it('parses an ADD command regardless of casing, spacing, accents, or language', () => { it('parses an ADD command regardless of casing, spacing, accents, or language', () => {
const variants = [ const variants = [
...@@ -109,6 +145,34 @@ describe('parsing commands', () => { ...@@ -109,6 +145,34 @@ describe('parsing commands', () => {
}) })
}) })
describe('DECLINE command', () => {
it('parses an DECLINE command regardless of casing, spacing, accents, or language', () => {
const variants = [
{
language: languages.EN,
messages: ['DECLINE', ' decline '],
},
{
language: languages.ES,
messages: ['RECHAZAR', ' rechazar '],
},
{
language: languages.FR,
messages: ['REFUSER', ' refuser '],
},
]
variants.forEach(({ language, messages }) =>
messages.forEach(msg =>
expect(parseExecutable(msg)).to.eql({
command: commands.DECLINE,
language,
payload: '',
}),
),
)
})
})
describe('HELP command', () => { describe('HELP command', () => {
it('parses an HELP command regardless of casing, spacing, accents, or language', () => { it('parses an HELP command regardless of casing, spacing, accents, or language', () => {
const variants = [ const variants = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment