Skip to content

Commit 8cec56d

Browse files
committed
Added tests for non-float evaluateEquals values
1 parent 0f89d56 commit 8cec56d

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

test/Runtime/Runtime.evaluateEquals.spec.js

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,33 @@ const expect = require('chai').expect;
44
const Runtime = require('../../src/Runtime');
55

66
describe('Runtime.evaluateEquals', function() {
7-
it('should get matching input data', function() {
7+
it('should compare same loose equals on non-float', function() {
88
const runtime = new Runtime();
99

10-
runtime.input = { foo: 'bar' };
11-
expect(runtime.getValueFromVariable('foo')).to.equal('bar');
10+
expect(runtime.evaluateEquals(1, true)).to.be.true;
1211
});
1312

14-
it('should error on missing input data', function() {
13+
it('should compare different loose equals on non-float', function() {
1514
const runtime = new Runtime();
1615

17-
runtime.input = {};
18-
expect(() => runtime.getValueFromVariable('foo')).to.throw(/Unset variable/);
16+
expect(runtime.evaluateEquals(0, true)).to.be.false;
17+
});
18+
19+
it('should compare same strict equals on non-float', function() {
20+
const runtime = new Runtime();
21+
22+
expect(runtime.evaluateEquals('foo', 'foo', true)).to.be.true;
23+
});
24+
25+
it('should compare different types strict equals on non-float', function() {
26+
const runtime = new Runtime();
27+
28+
expect(runtime.evaluateEquals(true, 1, true)).to.be.false;
29+
});
30+
31+
it('should compare different values strict equals on non-float', function() {
32+
const runtime = new Runtime();
33+
34+
expect(runtime.evaluateEquals('foo', 'bar', true)).to.be.false;
1935
});
2036
});

0 commit comments

Comments
 (0)