Security fixes (#32)
* Generic Object Injection Sink * (fix) "Character" is not defined. * added eslint * improve code quality, use refactored function * (fix) eslint jest * "Character" is not defined * removed unused file Compare.js * (fix) PointsUsed is not defined * (fix) eslint moans jsconfig * turn off "no-prototype-builtins" * push code coverage
This commit is contained in:
@ -139,7 +139,7 @@ it('should abort with a message: no entry found', () => {
|
||||
};
|
||||
const handleAttack = rewireUtils.__get__('handleAttack');
|
||||
//expect(handleAttack(err)).toThrowError();
|
||||
expect(handleAttack(null, [], { message: message })).toEqual(
|
||||
expect(handleAttack([], { message: message })).toEqual(
|
||||
'Sorry, für dich habe ich leider keinen Eintrag 😥'
|
||||
);
|
||||
});
|
||||
@ -152,7 +152,7 @@ it('should abort with a message: No such weapon', () => {
|
||||
};
|
||||
const handleAttack = rewireUtils.__get__('handleAttack');
|
||||
const args = [''];
|
||||
expect(handleAttack(null, [{ character: {} }], { message: message, args: args })).toEqual(
|
||||
expect(handleAttack([{ character: {} }], { message: message, args: args })).toEqual(
|
||||
'Diese Waffe gibt es nicht.'
|
||||
);
|
||||
});
|
||||
@ -178,9 +178,9 @@ it('complete run with melee weapon', () => {
|
||||
};
|
||||
const handleAttack = rewireUtils.__get__('handleAttack');
|
||||
const args = ['messer'];
|
||||
expect(
|
||||
handleAttack(null, [{ character: character }], { message: message, args: args })
|
||||
).toEqual(expect.any(String));
|
||||
expect(handleAttack([{ character: character }], { message: message, args: args })).toEqual(
|
||||
expect.any(String)
|
||||
);
|
||||
});
|
||||
|
||||
it('complete run with ranged weapon', () => {
|
||||
@ -204,7 +204,7 @@ it('complete run with ranged weapon', () => {
|
||||
};
|
||||
const handleAttack = rewireUtils.__get__('handleAttack');
|
||||
const args = ['langbogen'];
|
||||
expect(
|
||||
handleAttack(null, [{ character: character }], { message: message, args: args })
|
||||
).toEqual(expect.any(String));
|
||||
expect(handleAttack([{ character: character }], { message: message, args: args })).toEqual(
|
||||
expect.any(String)
|
||||
);
|
||||
});
|
||||
|
@ -17,8 +17,17 @@ const TestValues = [
|
||||
[13, 5],
|
||||
[14, 5],
|
||||
[15, 5],
|
||||
[16, 6],
|
||||
[17, 6],
|
||||
[18, 6],
|
||||
[19, 6],
|
||||
[20, 6],
|
||||
];
|
||||
|
||||
test.each(TestValues)('Retrieving Quality for %s', (input, output) => {
|
||||
expect(CalculateQuality(input)).toBe(output);
|
||||
});
|
||||
|
||||
it('should return 1 without input', () => {
|
||||
expect(CalculateQuality()).toBe(1);
|
||||
});
|
||||
|
@ -4,3 +4,7 @@ const { Capitalize } = require('@dsabot/Capitalize');
|
||||
it('should capitalize the first letter.', () => {
|
||||
expect(Capitalize('mother')).toBe('Mother');
|
||||
});
|
||||
|
||||
it('should capitalize without any word given', () => {
|
||||
expect(Capitalize()).toBe('None');
|
||||
});
|
||||
|
@ -7,3 +7,13 @@ it('turn any number into a string', () => {
|
||||
expect(f(0)).toBe('0');
|
||||
expect(f(-1)).toBe('-1');
|
||||
});
|
||||
|
||||
it('should return a string', () => {
|
||||
const obj = {
|
||||
Attributes: [8, 8, 8],
|
||||
Throws: [7, 7, 7],
|
||||
PointsUsed: [0, 0, 0],
|
||||
Bonus: 0,
|
||||
};
|
||||
expect(CreateResultTable(obj)).toEqual(expect.any(String));
|
||||
});
|
||||
|
Reference in New Issue
Block a user