summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@codeispoetry.ru>2017-06-19 19:16:16 +0300
committerAndrej Mihajlov <and@codeispoetry.ru>2017-06-21 12:27:05 +0300
commit912141007dc076924bec8ed25b32d067e19a176b (patch)
tree75bf7ddfdcaef08de17faa43639be8c7c1cf884f /test
parent8ecd87d4df667469414291e81667b10680770f3e (diff)
downloadmullvadvpn-912141007dc076924bec8ed25b32d067e19a176b.tar.xz
mullvadvpn-912141007dc076924bec8ed25b32d067e19a176b.zip
Replace TransitionRule.transitionDescriptor in favor of TransitionMatch
Diffstat (limited to 'test')
-rw-r--r--test/transition-rule.spec.js38
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