(dev) remove rewire, add babel-plugin-rewire. (#44)
* removed rewire. now using babel-rewire instead * implemented more tests * changed some eslint params * linting * linting * coverage on getChant Co-authored-by: Marcus Netz <marcus.netz@godyo.com>
This commit is contained in:
@ -69,7 +69,8 @@
|
|||||||
"no-console": 0,
|
"no-console": 0,
|
||||||
"no-unneeded-ternary": 0,
|
"no-unneeded-ternary": 0,
|
||||||
"object-shorthand": 0,
|
"object-shorthand": 0,
|
||||||
"no-useless-rename": 0
|
"no-useless-rename": 0,
|
||||||
|
"arrow-body-style": ["error", "as-needed", { "requireReturnForObjectLiteral": true }]
|
||||||
},
|
},
|
||||||
"env": {
|
"env": {
|
||||||
"node": true,
|
"node": true,
|
||||||
|
@ -1,217 +1,231 @@
|
|||||||
require('module-alias/register');
|
require('module-alias/register');
|
||||||
const rewire = require('rewire');
|
require('babel-plugin-rewire');
|
||||||
const Attack = require('@Commands/Attack');
|
const Attack = require('@Commands/Attack');
|
||||||
|
|
||||||
const rewireUtils = rewire('@Commands/Attack');
|
const getWeapon = Attack.__get__('getWeapon');
|
||||||
const getWeapon = rewireUtils.__get__('getWeapon');
|
const getAttributeLevel = Attack.__get__('getAttributeLevel');
|
||||||
const getAttributeLevel = rewireUtils.__get__('getAttributeLevel');
|
const getCombatTechniqueLevel = Attack.__get__('getCombatTechniqueLevel');
|
||||||
const getCombatTechniqueLevel = rewireUtils.__get__('getCombatTechniqueLevel');
|
const isMeleeWeapon = Attack.__get__('isMeleeWeapon');
|
||||||
const isMeleeWeapon = rewireUtils.__get__('isMeleeWeapon');
|
const getAttribute = Attack.__get__('getAttribute');
|
||||||
const getAttribute = rewireUtils.__get__('getAttribute');
|
const CompareAttackResult = Attack.__get__('CompareAttackResult');
|
||||||
const CompareAttackResult = rewireUtils.__get__('CompareAttackResult');
|
const getCombatTechnique = Attack.__get__('getCombatTechnique');
|
||||||
const getCombatTechnique = rewireUtils.__get__('getCombatTechnique');
|
describe('getCombatTechnique', () => {
|
||||||
|
it('should be undefined without value', () => {
|
||||||
it('should be undefined without value', () => {
|
expect(getCombatTechnique({})).toBeUndefined();
|
||||||
expect(getCombatTechnique({})).toBeUndefined();
|
});
|
||||||
|
it('should be undefined without value', () => {
|
||||||
|
expect(getCombatTechnique({ combattechnique: 'made-up' })).toBeUndefined();
|
||||||
|
});
|
||||||
|
it('should be null without any params.', () => {
|
||||||
|
expect(getCombatTechnique()).toBeNull();
|
||||||
|
});
|
||||||
|
it('should return defined object', () => {
|
||||||
|
expect(getCombatTechnique({ combattechnique: 'dolche' })).toEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
id: expect.any(String),
|
||||||
|
name: expect.any(String),
|
||||||
|
Leiteigenschaft: expect.anything(),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
it('should be undefined without value', () => {
|
describe('getAttribute', () => {
|
||||||
expect(getCombatTechnique({ combattechnique: 'made-up' })).toBeUndefined();
|
test('should return Object', () => {
|
||||||
});
|
const obj = { id: 'mut', kuerzel: 'MU', name: 'Mut' };
|
||||||
it('should be null without any params.', () => {
|
expect(getAttribute('KK')).toBeInstanceOf(Object);
|
||||||
expect(getCombatTechnique()).toBeNull();
|
expect(getAttribute('KK')).toEqual(
|
||||||
});
|
expect.objectContaining({
|
||||||
it('should return defined object', () => {
|
id: expect.any(String),
|
||||||
expect(getCombatTechnique({ combattechnique: 'dolche' })).toEqual(
|
kuerzel: expect.any(String),
|
||||||
expect.objectContaining({
|
name: expect.any(String),
|
||||||
id: expect.any(String),
|
})
|
||||||
name: expect.any(String),
|
);
|
||||||
Leiteigenschaft: expect.anything(),
|
expect(getAttribute('MU')).toEqual(obj);
|
||||||
})
|
});
|
||||||
);
|
|
||||||
});
|
|
||||||
test('getAttribute should return Object', () => {
|
|
||||||
const obj = { id: 'mut', kuerzel: 'MU', name: 'Mut' };
|
|
||||||
expect(getAttribute('KK')).toEqual(
|
|
||||||
expect.objectContaining({
|
|
||||||
id: expect.any(String),
|
|
||||||
kuerzel: expect.any(String),
|
|
||||||
name: expect.any(String),
|
|
||||||
})
|
|
||||||
);
|
|
||||||
expect(getAttribute('MU')).toEqual(obj);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('CompareAttackResults', () => {
|
describe('CompareAttackResults', () => {
|
||||||
expect(CompareAttackResult()).toEqual(
|
test('CompareAttackResults', () => {
|
||||||
expect.objectContaining({
|
expect(CompareAttackResult()).toEqual(
|
||||||
Ok: expect.any(Boolean),
|
expect.objectContaining({
|
||||||
Patzer: expect.any(Boolean),
|
Ok: expect.any(Boolean),
|
||||||
CriticalHit: expect.any(Boolean),
|
Patzer: expect.any(Boolean),
|
||||||
DoubleDamage: expect.any(Boolean),
|
CriticalHit: expect.any(Boolean),
|
||||||
Dice: expect.anything(),
|
DoubleDamage: expect.any(Boolean),
|
||||||
})
|
Dice: expect.anything(),
|
||||||
);
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return object with fumble', () => {
|
||||||
|
const obj = {
|
||||||
|
Ok: false,
|
||||||
|
Patzer: true,
|
||||||
|
CriticalHit: false,
|
||||||
|
DoubleDamage: false,
|
||||||
|
Dice: [20, 14],
|
||||||
|
};
|
||||||
|
expect(CompareAttackResult([20, 14], 8)).toEqual(obj);
|
||||||
|
});
|
||||||
|
it('should return object with crit', () => {
|
||||||
|
const obj = {
|
||||||
|
Ok: true,
|
||||||
|
Patzer: false,
|
||||||
|
CriticalHit: true,
|
||||||
|
DoubleDamage: false,
|
||||||
|
Dice: [1, 14],
|
||||||
|
};
|
||||||
|
expect(CompareAttackResult([1, 14], 8)).toEqual(obj);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return object with double damage', () => {
|
||||||
|
const obj = {
|
||||||
|
Ok: true,
|
||||||
|
Patzer: false,
|
||||||
|
CriticalHit: true,
|
||||||
|
DoubleDamage: true,
|
||||||
|
Dice: [1, 4],
|
||||||
|
};
|
||||||
|
expect(CompareAttackResult([1, 4], 8)).toEqual(obj);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return object without passing', () => {
|
||||||
|
const obj = {
|
||||||
|
Ok: false,
|
||||||
|
Patzer: false,
|
||||||
|
CriticalHit: false,
|
||||||
|
DoubleDamage: false,
|
||||||
|
Dice: [10],
|
||||||
|
};
|
||||||
|
expect(CompareAttackResult([10, 14], 8)).toEqual(obj);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('getAttributeLevel', () => {
|
||||||
|
it('returns a number ', () => {
|
||||||
|
expect(getAttributeLevel({ attributes: [{ id: 'mut', level: 8 }] }, 'mut')).toBe(8);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return object with fumble', () => {
|
describe('getCombatTechniqueLevel', () => {
|
||||||
const obj = {
|
it('returnsa defined object ', () => {
|
||||||
Ok: false,
|
const Player = { combattechniques: [{ id: 'dolche', level: 9 }] };
|
||||||
Patzer: true,
|
const CombatTechnique = { name: 'Dolche', id: 'dolche', Leiteigenschaft: ['GE'] };
|
||||||
CriticalHit: false,
|
|
||||||
DoubleDamage: false,
|
expect(getCombatTechniqueLevel(Player, CombatTechnique)).toEqual(
|
||||||
Dice: [20, 14],
|
expect.objectContaining({
|
||||||
};
|
id: expect.any(String),
|
||||||
expect(CompareAttackResult([20, 14], 8)).toEqual(obj);
|
name: expect.any(String),
|
||||||
|
level: expect.any(Number),
|
||||||
|
Leiteigenschaft: expect.any(Array),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
it('should return object with crit', () => {
|
describe('getWeapon', () => {
|
||||||
const obj = {
|
it('returns an object', () => {
|
||||||
Ok: true,
|
expect(getWeapon('waqqif')).toBeInstanceOf(Object);
|
||||||
Patzer: false,
|
});
|
||||||
CriticalHit: true,
|
it('returns a defined object ', () => {
|
||||||
DoubleDamage: false,
|
expect(getWeapon('waqqif')).toEqual(
|
||||||
Dice: [1, 14],
|
expect.objectContaining({
|
||||||
};
|
id: expect.any(String),
|
||||||
expect(CompareAttackResult([1, 14], 8)).toEqual(obj);
|
name: expect.any(String),
|
||||||
|
dice: expect.any(Number),
|
||||||
|
diemodificator: expect.any(Number),
|
||||||
|
at_mod: expect.any(Number),
|
||||||
|
pa_mod: expect.any(Number),
|
||||||
|
article: expect.any(Number),
|
||||||
|
DmgThreshold: expect.any(Number),
|
||||||
|
combattechnique: expect.any(String),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('isMeleeWeapon', () => {
|
||||||
|
it('returns true ', () => {
|
||||||
|
expect(isMeleeWeapon({ id: 'waqqif' })).toBeTruthy();
|
||||||
|
});
|
||||||
|
it('returns false ', () => {
|
||||||
|
expect(isMeleeWeapon({ id: 'bogen' })).toBeFalsy();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return object with double damage', () => {
|
describe('main Function', () => {
|
||||||
const obj = {
|
it('should abort with a message: no entry found', () => {
|
||||||
Ok: true,
|
const reply = jest.fn(str => str);
|
||||||
Patzer: false,
|
|
||||||
CriticalHit: true,
|
const message = {
|
||||||
DoubleDamage: true,
|
reply: reply,
|
||||||
Dice: [1, 4],
|
};
|
||||||
};
|
const handleAttack = Attack.__get__('handleAttack');
|
||||||
expect(CompareAttackResult([1, 4], 8)).toEqual(obj);
|
//expect(handleAttack(err)).toThrowError();
|
||||||
});
|
expect(handleAttack({}, { message: message })).toEqual(
|
||||||
|
'Sorry, für dich habe ich leider keinen Eintrag 😥'
|
||||||
it('should return object without passing', () => {
|
);
|
||||||
const obj = {
|
});
|
||||||
Ok: false,
|
|
||||||
Patzer: false,
|
it('should abort with a message: No such weapon', () => {
|
||||||
CriticalHit: false,
|
const reply = jest.fn(str => str);
|
||||||
DoubleDamage: false,
|
|
||||||
Dice: [10],
|
const message = {
|
||||||
};
|
reply: reply,
|
||||||
expect(CompareAttackResult([10, 14], 8)).toEqual(obj);
|
};
|
||||||
});
|
const handleAttack = Attack.__get__('handleAttack');
|
||||||
|
const args = [''];
|
||||||
it('returns a number ', () => {
|
expect(handleAttack([{ character: {} }], { message: message, args: args })).toEqual(
|
||||||
expect(getAttributeLevel({ attributes: [{ id: 'mut', level: 8 }] }, 'mut')).toBe(8);
|
'Diese Waffe gibt es nicht.'
|
||||||
});
|
);
|
||||||
|
});
|
||||||
it('returnsa defined object ', () => {
|
|
||||||
const Player = { combattechniques: [{ id: 'dolche', level: 9 }] };
|
it('complete run with melee weapon', () => {
|
||||||
const CombatTechnique = { name: 'Dolche', id: 'dolche', Leiteigenschaft: ['GE'] };
|
const reply = jest.fn(str => str);
|
||||||
|
|
||||||
expect(getCombatTechniqueLevel(Player, CombatTechnique)).toEqual(
|
const message = {
|
||||||
expect.objectContaining({
|
reply: reply,
|
||||||
id: expect.any(String),
|
};
|
||||||
name: expect.any(String),
|
const character = {
|
||||||
level: expect.any(Number),
|
attributes: [
|
||||||
Leiteigenschaft: expect.any(Array),
|
{ id: 'mut', level: 10 },
|
||||||
})
|
{ id: 'fingerfertigkeit', level: 10 },
|
||||||
);
|
{ id: 'klugheit', level: 10 },
|
||||||
});
|
{ id: 'intuition', level: 10 },
|
||||||
|
{ id: 'charisma', level: 10 },
|
||||||
it('returns a defined object ', () => {
|
{ id: 'gewandtheit', level: 16 },
|
||||||
expect(getWeapon('waqqif')).toEqual(
|
{ id: 'konstitution', level: 10 },
|
||||||
expect.objectContaining({
|
{ id: 'koerperkraft', level: 10 },
|
||||||
id: expect.any(String),
|
],
|
||||||
name: expect.any(String),
|
combattechniques: [{ id: 'dolche', level: 8 }],
|
||||||
dice: expect.any(Number),
|
};
|
||||||
diemodificator: expect.any(Number),
|
const handleAttack = Attack.__get__('handleAttack');
|
||||||
at_mod: expect.any(Number),
|
const args = ['messer'];
|
||||||
pa_mod: expect.any(Number),
|
expect(handleAttack({ character: character }, { message: message, args: args })).toEqual(
|
||||||
article: expect.any(Number),
|
expect.any(String)
|
||||||
DmgThreshold: expect.any(Number),
|
);
|
||||||
combattechnique: expect.any(String),
|
});
|
||||||
})
|
|
||||||
);
|
it('complete run with ranged weapon', () => {
|
||||||
});
|
const reply = jest.fn(str => str);
|
||||||
it('returns true ', () => {
|
|
||||||
expect(isMeleeWeapon({ id: 'waqqif' })).toBeTruthy();
|
const message = {
|
||||||
});
|
reply: reply,
|
||||||
it('returns false ', () => {
|
};
|
||||||
expect(isMeleeWeapon({ id: 'bogen' })).toBeFalsy();
|
const character = {
|
||||||
});
|
attributes: [
|
||||||
|
{ id: 'mut', level: 10 },
|
||||||
// main function
|
{ id: 'fingerfertigkeit', level: 14 },
|
||||||
|
{ id: 'klugheit', level: 10 },
|
||||||
it('should abort with a message: no entry found', () => {
|
{ id: 'intuition', level: 10 },
|
||||||
const reply = jest.fn(str => str);
|
{ id: 'charisma', level: 10 },
|
||||||
|
{ id: 'gewandtheit', level: 16 },
|
||||||
const message = {
|
{ id: 'konstitution', level: 10 },
|
||||||
reply: reply,
|
{ id: 'koerperkraft', level: 10 },
|
||||||
};
|
],
|
||||||
const handleAttack = rewireUtils.__get__('handleAttack');
|
combattechniques: [{ id: 'boegen', level: 8 }],
|
||||||
//expect(handleAttack(err)).toThrowError();
|
};
|
||||||
expect(handleAttack({}, { message: message })).toEqual(
|
const handleAttack = Attack.__get__('handleAttack');
|
||||||
'Sorry, für dich habe ich leider keinen Eintrag 😥'
|
const args = ['langbogen'];
|
||||||
);
|
expect(handleAttack({ character: character }, { message: message, args: args })).toEqual(
|
||||||
});
|
expect.any(String)
|
||||||
|
);
|
||||||
it('should abort with a message: No such weapon', () => {
|
});
|
||||||
const reply = jest.fn(str => str);
|
|
||||||
|
|
||||||
const message = {
|
|
||||||
reply: reply,
|
|
||||||
};
|
|
||||||
const handleAttack = rewireUtils.__get__('handleAttack');
|
|
||||||
const args = [''];
|
|
||||||
expect(handleAttack([{ character: {} }], { message: message, args: args })).toEqual(
|
|
||||||
'Diese Waffe gibt es nicht.'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('complete run with melee weapon', () => {
|
|
||||||
const reply = jest.fn(str => str);
|
|
||||||
|
|
||||||
const message = {
|
|
||||||
reply: reply,
|
|
||||||
};
|
|
||||||
const character = {
|
|
||||||
attributes: [
|
|
||||||
{ id: 'mut', level: 10 },
|
|
||||||
{ id: 'fingerfertigkeit', level: 10 },
|
|
||||||
{ id: 'klugheit', level: 10 },
|
|
||||||
{ id: 'intuition', level: 10 },
|
|
||||||
{ id: 'charisma', level: 10 },
|
|
||||||
{ id: 'gewandtheit', level: 16 },
|
|
||||||
{ id: 'konstitution', level: 10 },
|
|
||||||
{ id: 'koerperkraft', level: 10 },
|
|
||||||
],
|
|
||||||
combattechniques: [{ id: 'dolche', level: 8 }],
|
|
||||||
};
|
|
||||||
const handleAttack = rewireUtils.__get__('handleAttack');
|
|
||||||
const args = ['messer'];
|
|
||||||
expect(handleAttack({ character: character }, { message: message, args: args })).toEqual(
|
|
||||||
expect.any(String)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('complete run with ranged weapon', () => {
|
|
||||||
const reply = jest.fn(str => str);
|
|
||||||
|
|
||||||
const message = {
|
|
||||||
reply: reply,
|
|
||||||
};
|
|
||||||
const character = {
|
|
||||||
attributes: [
|
|
||||||
{ id: 'mut', level: 10 },
|
|
||||||
{ id: 'fingerfertigkeit', level: 14 },
|
|
||||||
{ id: 'klugheit', level: 10 },
|
|
||||||
{ id: 'intuition', level: 10 },
|
|
||||||
{ id: 'charisma', level: 10 },
|
|
||||||
{ id: 'gewandtheit', level: 16 },
|
|
||||||
{ id: 'konstitution', level: 10 },
|
|
||||||
{ id: 'koerperkraft', level: 10 },
|
|
||||||
],
|
|
||||||
combattechniques: [{ id: 'boegen', level: 8 }],
|
|
||||||
};
|
|
||||||
const handleAttack = rewireUtils.__get__('handleAttack');
|
|
||||||
const args = ['langbogen'];
|
|
||||||
expect(handleAttack({ character: character }, { message: message, args: args })).toEqual(
|
|
||||||
expect.any(String)
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
@ -1,39 +1,43 @@
|
|||||||
require('module-alias/register');
|
require('module-alias/register');
|
||||||
const rewire = require('rewire');
|
require('babel-plugin-rewire');
|
||||||
const Attribute = require('@Commands/Attribute');
|
const Attribute = require('@Commands/Attribute');
|
||||||
|
|
||||||
const rewireUtils = rewire('@Commands/Attribute');
|
const HandleNamedAttributes = Attribute.__get__('HandleNamedAttributes');
|
||||||
const HandleNamedAttributes = rewireUtils.__get__('HandleNamedAttributes');
|
const getAttributeLevel = Attribute.__get__('getAttributeLevel');
|
||||||
const getAttributeLevel = rewireUtils.__get__('getAttributeLevel');
|
const getAttribute = Attribute.__get__('getAttribute');
|
||||||
const getAttribute = rewireUtils.__get__('getAttribute');
|
const handleAttributeCheck = Attribute.__get__('handleAttributeCheck');
|
||||||
const handleAttributeCheck = rewireUtils.__get__('handleAttributeCheck');
|
|
||||||
test('getAttribute should return Object', () => {
|
|
||||||
const obj = { id: 'mut', kuerzel: 'MU', name: 'Mut' };
|
|
||||||
expect(getAttribute('KK')).toEqual(
|
|
||||||
expect.objectContaining({
|
|
||||||
id: expect.any(String),
|
|
||||||
kuerzel: expect.any(String),
|
|
||||||
name: expect.any(String),
|
|
||||||
})
|
|
||||||
);
|
|
||||||
expect(getAttribute('MU')).toEqual(obj);
|
|
||||||
expect(getAttribute('mut')).toEqual(obj);
|
|
||||||
});
|
|
||||||
it('should return undefined', () => {
|
|
||||||
expect(getAttribute()).toBeUndefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('returns a number ', () => {
|
describe('getAttribute', () => {
|
||||||
expect(getAttributeLevel({ attributes: [{ id: 'mut', level: 8 }] }, { id: 'mut' })).toBe(8);
|
test('getAttribute should return Object', () => {
|
||||||
|
const obj = { id: 'mut', kuerzel: 'MU', name: 'Mut' };
|
||||||
|
expect(getAttribute('KK')).toEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
id: expect.any(String),
|
||||||
|
kuerzel: expect.any(String),
|
||||||
|
name: expect.any(String),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
expect(getAttribute('MU')).toEqual(obj);
|
||||||
|
expect(getAttribute('mut')).toEqual(obj);
|
||||||
|
});
|
||||||
|
it('should return undefined', () => {
|
||||||
|
expect(getAttribute()).toBeUndefined();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
describe('getAttributeLevel', () => {
|
||||||
it('should return an object', () => {
|
it('returns a number ', () => {
|
||||||
const Character = {
|
expect(getAttributeLevel({ attributes: [{ id: 'mut', level: 8 }] }, { id: 'mut' })).toBe(8);
|
||||||
attributes: [{ id: 'mut', level: 8 }],
|
});
|
||||||
};
|
});
|
||||||
expect(HandleNamedAttributes({ Character: Character, args: ['mut'] })).toEqual({
|
describe('HandleNamedAttribute', () => {
|
||||||
Name: 'Mut',
|
it('should return an object', () => {
|
||||||
Level: 8,
|
const Character = {
|
||||||
|
attributes: [{ id: 'mut', level: 8 }],
|
||||||
|
};
|
||||||
|
expect(HandleNamedAttributes({ Character: Character, args: ['mut'] })).toEqual({
|
||||||
|
Name: 'Mut',
|
||||||
|
Level: 8,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
76
__tests__/commands/Chants.js
Normal file
76
__tests__/commands/Chants.js
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
require('module-alias/register');
|
||||||
|
require('babel-plugin-rewire');
|
||||||
|
|
||||||
|
const Chants = require('@Commands/Chants');
|
||||||
|
const createChantList = Chants.__get__('createChantList');
|
||||||
|
const TestValue = {
|
||||||
|
Name: 'Test',
|
||||||
|
Level: 10,
|
||||||
|
Attributes: [
|
||||||
|
{ Name: 'Klugheit', Level: 10 },
|
||||||
|
{ Name: 'Charisma', Level: 11 },
|
||||||
|
{ Name: 'Mut', Level: 12 },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
describe('createChantList', () => {
|
||||||
|
it('should return an array with expected object(s)', () => {
|
||||||
|
const Test = { chants: [{ id: 'test', level: 10 }] };
|
||||||
|
const expected = {
|
||||||
|
Name: 'Test',
|
||||||
|
Level: 10,
|
||||||
|
Attributes: [
|
||||||
|
{ Name: 'Klugheit', Level: 10 },
|
||||||
|
{ Name: 'Charisma', Level: 11 },
|
||||||
|
{ Name: 'Mut', Level: 12 },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
Chants.__Rewire__('getChant', () => expected);
|
||||||
|
|
||||||
|
expect(createChantList(Test)).toEqual(expect.arrayContaining([expected]));
|
||||||
|
Chants.__ResetDependency__('getChant');
|
||||||
|
});
|
||||||
|
it('should abort if character has no chants', () => {
|
||||||
|
expect(createChantList({ attributes: [] })).toBeNull();
|
||||||
|
expect(createChantList()).toBeNull();
|
||||||
|
expect(createChantList({})).toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('ReplyChant', () => {
|
||||||
|
const ReplyChant = Chants.__get__('ReplyChant');
|
||||||
|
it('should return null if no param given.', () => {
|
||||||
|
expect(ReplyChant()).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return a string', () => {
|
||||||
|
// toBeInstanceOf(String) is not working :(
|
||||||
|
expect(
|
||||||
|
ReplyChant({
|
||||||
|
Name: 'Test',
|
||||||
|
Level: 9,
|
||||||
|
Attributes: [
|
||||||
|
{ Name: 'Klugheit', Level: 10 },
|
||||||
|
{ Name: 'Charisma', Level: 11 },
|
||||||
|
{ Name: 'Mut', Level: 12 },
|
||||||
|
],
|
||||||
|
})
|
||||||
|
).toMatch(/.*Test.*(9)?.*/);
|
||||||
|
});
|
||||||
|
|
||||||
|
Chants.__ResetDependency__('ReplyChant');
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('ReplyChantList', () => {
|
||||||
|
const ReplyChantList = Chants.__get__('ReplyChantList');
|
||||||
|
it('should return null if params are empty', () => {
|
||||||
|
expect(ReplyChantList('')).toBeNull();
|
||||||
|
expect(ReplyChantList([])).toBeNull();
|
||||||
|
expect(ReplyChantList()).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return Name and Level', () => {
|
||||||
|
const input = [TestValue];
|
||||||
|
expect(ReplyChantList(input)).toMatch('Test (10)');
|
||||||
|
});
|
||||||
|
});
|
@ -1,39 +1,134 @@
|
|||||||
require('module-alias/register');
|
require('module-alias/register');
|
||||||
|
require('babel-plugin-rewire');
|
||||||
const List = require('@Commands/List');
|
const List = require('@Commands/List');
|
||||||
|
|
||||||
const rewire = require('rewire');
|
|
||||||
|
|
||||||
const reWireUtils = rewire('@Commands/List');
|
|
||||||
// const getStats = reWireUtils.__get__('getStats');
|
// const getStats = reWireUtils.__get__('getStats');
|
||||||
const getAttribute = reWireUtils.__get__('getAttribute');
|
const getAttribute = List.__get__('getAttribute');
|
||||||
const printHeader = reWireUtils.__get__('printHeader');
|
const printHeader = List.__get__('printHeader');
|
||||||
const listStats = reWireUtils.__get__('listStats');
|
const listStats = List.__get__('listStats');
|
||||||
it('should return an attribute object', () => {
|
|
||||||
expect(getAttribute({ id: 'mut', level: 9 })).toEqual(
|
describe('getAttributes', () => {
|
||||||
expect.objectContaining({
|
it('should return an attribute object', () => {
|
||||||
id: 'mut',
|
expect(getAttribute({ id: 'mut', level: 9 })).toEqual(
|
||||||
Name: 'Mut',
|
expect.objectContaining({
|
||||||
Level: 9,
|
id: 'mut',
|
||||||
})
|
Name: 'Mut',
|
||||||
);
|
Level: 9,
|
||||||
expect(getAttribute()).toEqual(
|
})
|
||||||
expect.objectContaining({
|
);
|
||||||
id: expect.any(String),
|
expect(getAttribute()).toEqual(
|
||||||
Name: expect.any(String),
|
expect.objectContaining({
|
||||||
Level: expect.any(Number),
|
id: expect.any(String),
|
||||||
})
|
Name: expect.any(String),
|
||||||
);
|
Level: expect.any(Number),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
it('should return null', () => {
|
describe('printHeader', () => {
|
||||||
expect(printHeader()).toBeNull();
|
it('should return null with no params', () => {
|
||||||
});
|
expect(printHeader()).toBeNull();
|
||||||
it('should return a string', () => {
|
});
|
||||||
const attributes = [{ Short: 'AA' }, { Short: 'BB' }, { Short: 'CC' }];
|
it('should return a string', () => {
|
||||||
expect(printHeader(attributes)).toMatch(/\s+AA\s+[|]\s+BB\s+[|]\s+CC\s+/g);
|
const attributes = [{ Short: 'AA' }, { Short: 'BB' }, { Short: 'CC' }];
|
||||||
|
expect(printHeader(attributes)).toMatch(/\s+AA\s+[|]\s+BB\s+[|]\s+CC\s+/g);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a string', () => {
|
describe('listStats', () => {
|
||||||
expect(listStats([{ Level: 8 }, { Level: 9 }, { Level: 10 }])).toMatch(
|
it('should return a string', () => {
|
||||||
/\s+8\s+[|]\s+9\s+[|]\s+10\s+/
|
expect(listStats([{ Level: 8 }, { Level: 9 }, { Level: 10 }])).toMatch(
|
||||||
);
|
/\s+8\s+[|]\s+9\s+[|]\s+10\s+/
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('findUser', () => {
|
||||||
|
const expected = {
|
||||||
|
user: 'Test',
|
||||||
|
character: {
|
||||||
|
name: 'test',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
List.__Rewire__('db', {
|
||||||
|
findOne: () => Promise.resolve(expected),
|
||||||
|
});
|
||||||
|
const findUser = List.__get__('findUser');
|
||||||
|
expect(findUser()).toBeInstanceOf(Promise);
|
||||||
|
expect(findUser()).resolves.toEqual(expected);
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
describe('findUsers', () => {
|
||||||
|
const expected = {
|
||||||
|
user: 'Test',
|
||||||
|
character: {
|
||||||
|
name: 'test',
|
||||||
|
attributes: [{ id: 'mut', level: 9 }],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
List.__Rewire__('db', {
|
||||||
|
findOne: () => {
|
||||||
|
return Promise.resolve(expected);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const findUsers = List.__get__('findUsers');
|
||||||
|
expect(findUser()).toBeInstanceOf(Promise);
|
||||||
|
expect(findUser()).resolves.toEqual(expected);
|
||||||
|
});*/
|
||||||
|
|
||||||
|
describe('getStats', () => {
|
||||||
|
it('should give name, id and level in order', () => {
|
||||||
|
const getStats = List.__get__('getStats');
|
||||||
|
const user = {
|
||||||
|
character: {
|
||||||
|
attributes: [
|
||||||
|
{ id: 'mut', level: 10 },
|
||||||
|
{ id: 'klugheit', level: 11 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(getStats(user)).toEqual(
|
||||||
|
expect.arrayContaining([
|
||||||
|
{
|
||||||
|
Name: expect.any(String),
|
||||||
|
Level: expect.any(Number),
|
||||||
|
Short: expect.any(String),
|
||||||
|
id: expect.any(String),
|
||||||
|
},
|
||||||
|
])
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('returnResult', () => {
|
||||||
|
const returnResult = List.__get__('returnResult');
|
||||||
|
|
||||||
|
const message = { reply: str => str };
|
||||||
|
const characters = [
|
||||||
|
{
|
||||||
|
Name: 'Zulu',
|
||||||
|
Attributes: [
|
||||||
|
{ id: 'charisma', Level: 7, Short: 'CH' },
|
||||||
|
{ id: 'mut', Level: 14, Short: 'MU' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: 'Alfa',
|
||||||
|
Attributes: [
|
||||||
|
{ id: 'mut', Level: 10, Short: 'MU' },
|
||||||
|
{ id: 'charisma', Level: 11, Short: 'CH' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
it('returns if no characters were found', () => {
|
||||||
|
expect(returnResult(message, [])).toBe('Keine Benutzer auf dieser Liste gefunden.');
|
||||||
|
expect(returnResult(message)).toBe('Keine Benutzer auf dieser Liste gefunden.');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns a string ', () => {
|
||||||
|
expect(returnResult(message, characters)).toMatch(/.*/);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
12
__tests__/commands/Roll.js
Normal file
12
__tests__/commands/Roll.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
require('module-alias/register');
|
||||||
|
require('babel-plugin-rewire');
|
||||||
|
|
||||||
|
const command = require('@Commands/Roll');
|
||||||
|
//const exec = command.__get__('exec');
|
||||||
|
describe('roll command', () => {
|
||||||
|
const message = { reply: str => str };
|
||||||
|
it('should not return anything without correct arguments', () => {
|
||||||
|
const args = ['1'];
|
||||||
|
expect(command.exec(message, args)).resolves.toBeUndefined();
|
||||||
|
});
|
||||||
|
});
|
103
__tests__/functions/getChant.js
Normal file
103
__tests__/functions/getChant.js
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
require('module-alias/register');
|
||||||
|
require('babel-plugin-rewire');
|
||||||
|
|
||||||
|
const command = require('@dsabot/getChant');
|
||||||
|
|
||||||
|
describe('getChant integration test', () => {
|
||||||
|
it('should not find an entry for a chant', () => {
|
||||||
|
const getChant = command.__get__('getChant');
|
||||||
|
expect(getChant({ Character: { name: '' }, chant_name: 'test' })).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return null if char has no chants.', () => {
|
||||||
|
const Character = {
|
||||||
|
attributes: [
|
||||||
|
{ id: 'mut', level: 10 },
|
||||||
|
{ id: 'klugheit', level: 11 },
|
||||||
|
{ id: 'charisma', level: 12 },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
command.__set__('Chants', [{ id: 'test', name: 'Test', attributes: ['MU', 'KL', 'CH'] }]);
|
||||||
|
|
||||||
|
const getChant = command.__get__('getChant');
|
||||||
|
|
||||||
|
expect(getChant({ Character: Character, chant_name: 'test' })).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return a correct chant result.', () => {
|
||||||
|
const Character = {
|
||||||
|
attributes: [
|
||||||
|
{ id: 'mut', level: 10 },
|
||||||
|
{ id: 'klugheit', level: 11 },
|
||||||
|
{ id: 'charisma', level: 12 },
|
||||||
|
],
|
||||||
|
chants: [{ id: 'test', level: 7 }, { id: 'no-level' }],
|
||||||
|
};
|
||||||
|
const Chants = [
|
||||||
|
{
|
||||||
|
id: 'test',
|
||||||
|
name: 'Testchant',
|
||||||
|
attributes: ['MU', 'KL', 'CH'],
|
||||||
|
},
|
||||||
|
{ id: 'no-level', name: 'No Level', attributes: ['MU', 'KL', 'CH'] },
|
||||||
|
];
|
||||||
|
|
||||||
|
command.__set__('Chants', Chants);
|
||||||
|
|
||||||
|
const getChant = command.__get__('getChant');
|
||||||
|
|
||||||
|
expect(getChant({ Character: Character, chant_name: 'test' })).toEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
Name: 'Testchant',
|
||||||
|
Level: 7,
|
||||||
|
Attributes: [
|
||||||
|
{ Level: 10, Name: 'MU' },
|
||||||
|
{ Level: 11, Name: 'KL' },
|
||||||
|
{ Level: 12, Name: 'CH' },
|
||||||
|
],
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(getChant({ Character: Character, chant_name: 'Testchant' })).toEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
Name: 'Testchant',
|
||||||
|
Level: 7,
|
||||||
|
Attributes: [
|
||||||
|
{ Level: 10, Name: 'MU' },
|
||||||
|
{ Level: 11, Name: 'KL' },
|
||||||
|
{ Level: 12, Name: 'CH' },
|
||||||
|
],
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(getChant({ Character: Character, chant_name: 'no-level' })).toEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
Name: 'No Level',
|
||||||
|
Level: 0,
|
||||||
|
Attributes: [
|
||||||
|
{ Level: 10, Name: 'MU' },
|
||||||
|
{ Level: 11, Name: 'KL' },
|
||||||
|
{ Level: 12, Name: 'CH' },
|
||||||
|
],
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not find the chant.', () => {
|
||||||
|
const Character = {
|
||||||
|
attributes: [
|
||||||
|
{ id: 'mut', level: 10 },
|
||||||
|
{ id: 'klugheit', level: 11 },
|
||||||
|
{ id: 'charisma', level: 12 },
|
||||||
|
],
|
||||||
|
chants: [{ id: 'test', level: 7 }],
|
||||||
|
};
|
||||||
|
const Chants = [{ id: 'test', name: 'Testchant', attributes: ['MU', 'KL', 'CH'] }];
|
||||||
|
|
||||||
|
command.__set__('Chants', Chants);
|
||||||
|
|
||||||
|
const getChant = command.__get__('getChant');
|
||||||
|
|
||||||
|
expect(getChant({ Character: Character, chant_name: 'well-hidden' })).toBeNull();
|
||||||
|
});
|
||||||
|
});
|
@ -1,3 +1,16 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: ['babel-plugin-rewire'],
|
plugins: [
|
||||||
|
'babel-plugin-rewire',
|
||||||
|
[
|
||||||
|
'module-resolver',
|
||||||
|
{
|
||||||
|
root: ['.'],
|
||||||
|
alias: {
|
||||||
|
'@Lib': './lib',
|
||||||
|
'@dsabot': './functions',
|
||||||
|
'@Commands': './commands',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
require('module-alias/register');
|
||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
const { findMessage } = require('@dsabot/findMessage');
|
const { findMessage } = require('@dsabot/findMessage');
|
||||||
const { getChant } = require('@dsabot/getChant');
|
const { getChant } = require('@dsabot/getChant');
|
||||||
@ -11,19 +12,18 @@ const createChantList = (Character = {}) => {
|
|||||||
Character.chants.forEach(chant =>
|
Character.chants.forEach(chant =>
|
||||||
ChantList.push(getChant({ Character: Character, chant_name: chant.id }))
|
ChantList.push(getChant({ Character: Character, chant_name: chant.id }))
|
||||||
);
|
);
|
||||||
console.log(ChantList);
|
|
||||||
return ChantList.filter(value => value !== undefined && value !== null);
|
return ChantList.filter(value => value !== undefined && value !== null);
|
||||||
};
|
};
|
||||||
|
|
||||||
const ReplyChantList = (ChantList = []) => {
|
const ReplyChantList = (ChantList = []) => {
|
||||||
if (!ChantList) return null;
|
if (!ChantList || ChantList.length === 0) return null;
|
||||||
return `${ChantList.map(chant => `${chant.Name} ${chant.Level ? `(${chant.Level})` : ''}`).join(
|
return `${ChantList.map(chant => `${chant.Name} ${chant.Level ? `(${chant.Level})` : ''}`).join(
|
||||||
'\n'
|
'\n'
|
||||||
)}`;
|
)}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ReplyChant = (Chant = {}) => {
|
const ReplyChant = (Chant = {}) => {
|
||||||
if (!Chant) return null;
|
if (!Chant || Object.keys(Chant).length === 0) return null;
|
||||||
return `Deine Werte für ${Chant.Name} ${Chant.Level ? `(${Chant.Level})` : ''} sind:
|
return `Deine Werte für ${Chant.Name} ${Chant.Level ? `(${Chant.Level})` : ''} sind:
|
||||||
|
|
||||||
${Chant.Attributes.map(attribute => `${attribute.Name}: ${attribute.Level}`).join(' ')}
|
${Chant.Attributes.map(attribute => `${attribute.Name}: ${attribute.Level}`).join(' ')}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const Capitalize = (Word = 'none') => {
|
const Capitalize = (Word = 'none') => {
|
||||||
return Word[0].toUpperCase() + Word.substring(1);
|
return Word[0].toUpperCase() + Word.substring(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = { Capitalize };
|
module.exports = { Capitalize };
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const CountOccurences = (arr, value) => {
|
const CountOccurences = (arr, value) => {
|
||||||
return arr.filter((v) => (v === value)).length;
|
return arr.filter(v => v === value).length;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = { CountOccurences };
|
module.exports = { CountOccurences };
|
@ -1,22 +1,18 @@
|
|||||||
|
require('module-alias/register');
|
||||||
const { getAttributeLevels } = require('@dsabot/getAttributeLevels');
|
const { getAttributeLevels } = require('@dsabot/getAttributeLevels');
|
||||||
const Chants = require('@Lib/Chants.json');
|
const Chants = require('@Lib/Chants.json');
|
||||||
|
const { isEmpty } = require('@dsabot/isEmpty');
|
||||||
|
|
||||||
const getChant = ({ Character: Character = [], chant_name: chantName = '' } = {}) => {
|
const getChant = ({ Character: Character = [], chant_name: chantName = '' } = {}) => {
|
||||||
//if (!Character.hasOwnProperty('chants')) return;
|
if (!Character.hasOwnProperty('chants')) return null;
|
||||||
const chantEntry =
|
const chantEntry =
|
||||||
Chants.find(chant => chant.id.toLowerCase() === chantName.toLowerCase()) ||
|
Chants.find(chant => chant.id.toLowerCase() === chantName.toLowerCase()) ||
|
||||||
Chants.find(chant => chant.name.toLowerCase() === chantName.toLowerCase());
|
Chants.find(chant => chant.name.toLowerCase() === chantName.toLowerCase());
|
||||||
|
|
||||||
if (!chantEntry) {
|
// let us filter out blessings.
|
||||||
console.log(`getChant() Did not find entry for ${chantName}`);
|
if (isEmpty(chantEntry)) return null;
|
||||||
return null;
|
const Chant = Character.chants.find(chant => chant.id === chantEntry.id); // || null;
|
||||||
}
|
const Level = Chant.hasOwnProperty('level') ? Chant.level : 0;
|
||||||
|
|
||||||
let Level = 0; // This is the minimum attributes value.
|
|
||||||
const Chant = Character.chants.find(chant => chant.id === chantEntry.id) || null;
|
|
||||||
if (Chant && Chant.hasOwnProperty('level')) {
|
|
||||||
Level = Chant.level || 0;
|
|
||||||
}
|
|
||||||
const Attributes = getAttributeLevels(chantEntry.attributes, Character);
|
const Attributes = getAttributeLevels(chantEntry.attributes, Character);
|
||||||
|
|
||||||
return { Name: chantEntry.name, Level: Level, Attributes: Attributes };
|
return { Name: chantEntry.name, Level: Level, Attributes: Attributes };
|
||||||
|
227
package-lock.json
generated
227
package-lock.json
generated
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "dsabot",
|
"name": "dsabot",
|
||||||
"version": "1.6.1",
|
"version": "1.6.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"version": "1.6.1",
|
"version": "1.6.2",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord.js": "^12.5.3",
|
"discord.js": "^12.5.3",
|
||||||
@ -17,13 +17,14 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.23",
|
"@types/jest": "^26.0.23",
|
||||||
|
"babel-jest": "^26.6.3",
|
||||||
|
"babel-plugin-module-resolver": "^4.1.0",
|
||||||
"babel-plugin-rewire": "^1.2.0",
|
"babel-plugin-rewire": "^1.2.0",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"eslint-config-airbnb": "^18.2.1",
|
"eslint-config-airbnb": "^18.2.1",
|
||||||
"eslint-config-prettier": "^6.8.0",
|
"eslint-config-prettier": "^6.8.0",
|
||||||
"eslint-plugin-prettier": "^3.4.0",
|
"eslint-plugin-prettier": "^3.4.0",
|
||||||
"jest": "^26.6.3",
|
"jest": "^26.6.3"
|
||||||
"rewire": "^5.0.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/code-frame": {
|
"node_modules/@babel/code-frame": {
|
||||||
@ -1341,6 +1342,22 @@
|
|||||||
"node": ">= 10.14.2"
|
"node": ">= 10.14.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/babel-plugin-module-resolver": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/babel-plugin-module-resolver/-/babel-plugin-module-resolver-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-MlX10UDheRr3lb3P0WcaIdtCSRlxdQsB1sBqL7W0raF070bGl1HQQq5K3T2vf2XAYie+ww+5AKC/WrkjRO2knA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"find-babel-config": "^1.2.0",
|
||||||
|
"glob": "^7.1.6",
|
||||||
|
"pkg-up": "^3.1.0",
|
||||||
|
"reselect": "^4.0.0",
|
||||||
|
"resolve": "^1.13.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/babel-plugin-rewire": {
|
"node_modules/babel-plugin-rewire": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/babel-plugin-rewire/-/babel-plugin-rewire-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/babel-plugin-rewire/-/babel-plugin-rewire-1.2.0.tgz",
|
||||||
@ -3437,6 +3454,37 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/find-babel-config": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/find-babel-config/-/find-babel-config-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-jB2CHJeqy6a820ssiqwrKMeyC6nNdmrcgkKWJWmpoxpE8RKciYJXCcXRq1h2AzCo5I5BJeN2tkGEO3hLTuePRA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"json5": "^0.5.1",
|
||||||
|
"path-exists": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/find-babel-config/node_modules/json5": {
|
||||||
|
"version": "0.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz",
|
||||||
|
"integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"json5": "lib/cli.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/find-babel-config/node_modules/path-exists": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/find-up": {
|
"node_modules/find-up": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
|
||||||
@ -6092,6 +6140,64 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/pkg-up": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"find-up": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pkg-up/node_modules/find-up": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"locate-path": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pkg-up/node_modules/locate-path": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"p-locate": "^3.0.0",
|
||||||
|
"path-exists": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pkg-up/node_modules/p-locate": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"p-limit": "^2.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pkg-up/node_modules/path-exists": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/posix-character-classes": {
|
"node_modules/posix-character-classes": {
|
||||||
"version": "0.1.1",
|
"version": "0.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
|
||||||
@ -6502,6 +6608,12 @@
|
|||||||
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
|
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/reselect": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/reselect/-/reselect-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-qUgANli03jjAyGlnbYVAV5vvnOmJnODyABz51RdBN7M4WaVu8mecZWgyQNkG8Yqe3KRGRt0l4K4B3XVEULC4CA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/resolve": {
|
"node_modules/resolve": {
|
||||||
"version": "1.19.0",
|
"version": "1.19.0",
|
||||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz",
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz",
|
||||||
@ -6565,16 +6677,6 @@
|
|||||||
"node": ">=0.12"
|
"node": ">=0.12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/rewire": {
|
|
||||||
"version": "5.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/rewire/-/rewire-5.0.0.tgz",
|
|
||||||
"integrity": "sha512-1zfitNyp9RH5UDyGGLe9/1N0bMlPQ0WrX0Tmg11kMHBpqwPJI4gfPpP7YngFyLbFmhXh19SToAG0sKKEFcOIJA==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"eslint": "^6.8.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/rimraf": {
|
"node_modules/rimraf": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
||||||
@ -9529,6 +9631,19 @@
|
|||||||
"@types/babel__traverse": "^7.0.6"
|
"@types/babel__traverse": "^7.0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"babel-plugin-module-resolver": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/babel-plugin-module-resolver/-/babel-plugin-module-resolver-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-MlX10UDheRr3lb3P0WcaIdtCSRlxdQsB1sBqL7W0raF070bGl1HQQq5K3T2vf2XAYie+ww+5AKC/WrkjRO2knA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"find-babel-config": "^1.2.0",
|
||||||
|
"glob": "^7.1.6",
|
||||||
|
"pkg-up": "^3.1.0",
|
||||||
|
"reselect": "^4.0.0",
|
||||||
|
"resolve": "^1.13.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"babel-plugin-rewire": {
|
"babel-plugin-rewire": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/babel-plugin-rewire/-/babel-plugin-rewire-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/babel-plugin-rewire/-/babel-plugin-rewire-1.2.0.tgz",
|
||||||
@ -11188,6 +11303,30 @@
|
|||||||
"to-regex-range": "^5.0.1"
|
"to-regex-range": "^5.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"find-babel-config": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/find-babel-config/-/find-babel-config-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-jB2CHJeqy6a820ssiqwrKMeyC6nNdmrcgkKWJWmpoxpE8RKciYJXCcXRq1h2AzCo5I5BJeN2tkGEO3hLTuePRA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"json5": "^0.5.1",
|
||||||
|
"path-exists": "^3.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"json5": {
|
||||||
|
"version": "0.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz",
|
||||||
|
"integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"path-exists": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"find-up": {
|
"find-up": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
|
||||||
@ -13223,6 +13362,51 @@
|
|||||||
"find-up": "^4.0.0"
|
"find-up": "^4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"pkg-up": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"find-up": "^3.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"find-up": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"locate-path": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"locate-path": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"p-locate": "^3.0.0",
|
||||||
|
"path-exists": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"p-locate": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"p-limit": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"path-exists": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"posix-character-classes": {
|
"posix-character-classes": {
|
||||||
"version": "0.1.1",
|
"version": "0.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
|
||||||
@ -13529,6 +13713,12 @@
|
|||||||
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
|
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"reselect": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/reselect/-/reselect-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-qUgANli03jjAyGlnbYVAV5vvnOmJnODyABz51RdBN7M4WaVu8mecZWgyQNkG8Yqe3KRGRt0l4K4B3XVEULC4CA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"resolve": {
|
"resolve": {
|
||||||
"version": "1.19.0",
|
"version": "1.19.0",
|
||||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz",
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz",
|
||||||
@ -13576,15 +13766,6 @@
|
|||||||
"integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==",
|
"integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"rewire": {
|
|
||||||
"version": "5.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/rewire/-/rewire-5.0.0.tgz",
|
|
||||||
"integrity": "sha512-1zfitNyp9RH5UDyGGLe9/1N0bMlPQ0WrX0Tmg11kMHBpqwPJI4gfPpP7YngFyLbFmhXh19SToAG0sKKEFcOIJA==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"eslint": "^6.8.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rimraf": {
|
"rimraf": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
||||||
|
@ -26,13 +26,14 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.23",
|
"@types/jest": "^26.0.23",
|
||||||
|
"babel-jest": "^26.6.3",
|
||||||
|
"babel-plugin-module-resolver": "^4.1.0",
|
||||||
"babel-plugin-rewire": "^1.2.0",
|
"babel-plugin-rewire": "^1.2.0",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"eslint-config-airbnb": "^18.2.1",
|
"eslint-config-airbnb": "^18.2.1",
|
||||||
"eslint-config-prettier": "^6.8.0",
|
"eslint-config-prettier": "^6.8.0",
|
||||||
"eslint-plugin-prettier": "^3.4.0",
|
"eslint-plugin-prettier": "^3.4.0",
|
||||||
"jest": "^26.6.3",
|
"jest": "^26.6.3"
|
||||||
"rewire": "^5.0.0"
|
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"collectCoverage": true,
|
"collectCoverage": true,
|
||||||
|
Reference in New Issue
Block a user