m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/__tests__/parser.test.js
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2017-08-22 18:01:48 -0400
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2017-08-22 18:15:15 -0400
commit1426322eb4898cd49310c1dc30cdfc8ad8e73402 (patch)
treec22776bb6af5180d41b90d0ceb7c06c03c66dd9b /__tests__/parser.test.js
parent12a632d2772da84043d4335eeabbca505efd760f (diff)
Parse negative bonuses
Diffstat (limited to '__tests__/parser.test.js')
-rw-r--r--__tests__/parser.test.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/__tests__/parser.test.js b/__tests__/parser.test.js
index 873972b..54e1da7 100644
--- a/__tests__/parser.test.js
+++ b/__tests__/parser.test.js
@@ -163,6 +163,18 @@ describe('parse', () => {
})
})
+ it('parses negative bonuses', () => {
+ expect(parse('3d4-1')).toEqual({
+ type: 'bonusSubtract',
+ left: {
+ type: 'd',
+ left: { type: 'constant', value: 3 },
+ right: { type: 'constant', value: 4 }
+ },
+ right: { type: 'constant', value: 1 }
+ })
+ })
+
describe('parsing parentheses', () => {
test('(1d6)d6', () => {
expect(parse('(1d6)d6')).toEqual({