m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/__tests__/parser.test.js
diff options
context:
space:
mode:
Diffstat (limited to '__tests__/parser.test.js')
-rw-r--r--__tests__/parser.test.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/__tests__/parser.test.js b/__tests__/parser.test.js
index b0dc28d..6fe296c 100644
--- a/__tests__/parser.test.js
+++ b/__tests__/parser.test.js
@@ -56,4 +56,20 @@ describe('parse', () => {
}
})
})
+
+ it('parses dice subtraction', () => {
+ expect(parse('1d6 - 2d8')).toEqual({
+ type: 'subtract',
+ left: {
+ type: 'd',
+ left: { type: 'constant', value: 1 },
+ right: { type: 'constant', value: 6 }
+ },
+ right: {
+ type: 'd',
+ left: { type: 'constant', value: 2 },
+ right: { type: 'constant', value: 8 }
+ }
+ })
+ })
})