diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/transition-rule.spec.js | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/test/transition-rule.spec.js b/test/transition-rule.spec.js index ba5ea15e64..647517ca5d 100644 --- a/test/transition-rule.spec.js +++ b/test/transition-rule.spec.js @@ -11,38 +11,48 @@ describe('TransitionRule', () => { it('should match wildcard rule', () => { const rule = new TransitionRule(null, '/route', testTransition); - expect(rule.match(null, '/route')).to.be.true; - expect(rule.transitionDescriptor().name).to.be.equal('forward'); + expect(rule.match(null, '/route')).to.deep.equal({ + direction: 'forward', + descriptor: { name: 'forward', duration: 0.25 } + }); - expect(rule.match('/somewhere', '/route')).to.be.true; - expect(rule.transitionDescriptor().name).to.be.equal('forward'); + expect(rule.match('/somewhere', '/route')).to.deep.equal({ + direction: 'forward', + descriptor: { name: 'forward', duration: 0.25 } + }); }); it('should match wildcard rule reversion', () => { const rule = new TransitionRule(null, '/route', testTransition); - expect(rule.match('/route', '/other')).to.be.true; - expect(rule.transitionDescriptor().name).to.be.equal('backward'); + expect(rule.match('/route', '/other')).to.deep.equal({ + direction: 'backward', + descriptor: { name: 'backward', duration: 0.25 } + }); }); it('should match exact rule', () => { const rule = new TransitionRule('/route1', '/route2', testTransition); - expect(rule.match('/other', '/route1')).to.be.false; - expect(rule.match('/other', '/route2')).to.be.false; + expect(rule.match('/other', '/route1')).to.be.null; + expect(rule.match('/other', '/route2')).to.be.null; - expect(rule.match('/route1', '/route2')).to.be.true; - expect(rule.transitionDescriptor().name).to.be.equal('forward'); + expect(rule.match('/route1', '/route2')).to.deep.equal({ + direction: 'forward', + descriptor: { name: 'forward', duration: 0.25 } + }); }); it('should match exact rule reversion', () => { const rule = new TransitionRule('/route1', '/route2', testTransition); - expect(rule.match('/route1', '/other')).to.be.false; - expect(rule.match('/route2', '/other')).to.be.false; + expect(rule.match('/route1', '/other')).to.be.null; + expect(rule.match('/route2', '/other')).to.be.null; - expect(rule.match('/route2', '/route1')).to.be.true; - expect(rule.transitionDescriptor().name).to.be.equal('backward'); + expect(rule.match('/route2', '/route1')).to.deep.equal({ + direction: 'backward', + descriptor: { name: 'backward', duration: 0.25 } + }); }); });
\ No newline at end of file |
