|
1 | 1 | describe('configuration', function () {
|
2 | 2 | var assert = chai.assert;
|
| 3 | + var expect = chai.expect; |
3 | 4 |
|
4 | 5 | var origConfig;
|
5 | 6 |
|
@@ -73,7 +74,6 @@ describe('configuration', function () {
|
73 | 74 | assert.include(err.stack, 'fooPropThrows', 'should have user stack trace in error message');
|
74 | 75 | }
|
75 | 76 | }
|
76 |
| - |
77 | 77 | });
|
78 | 78 |
|
79 | 79 | it('is false for property assertions', function () {
|
@@ -167,6 +167,33 @@ describe('configuration', function () {
|
167 | 167 | chai.config.showDiff = !chai.config.showDiff;
|
168 | 168 | assert.equal(chai.Assertion.showDiff, chai.config.showDiff);
|
169 | 169 | });
|
170 |
| - |
| 170 | + }); |
| 171 | + |
| 172 | + describe('useProxy', function() { |
| 173 | + var readNoExistentProperty = function() { |
| 174 | + expect(false).to.be.tue; // typo: tue should be true |
| 175 | + }; |
| 176 | + |
| 177 | + it('should have default value equal to true', function() { |
| 178 | + expect(chai.config.useProxy).to.be.true; |
| 179 | + }); |
| 180 | + |
| 181 | + describe('when true', function() { |
| 182 | + it('should use proxy unless user\'s environment doesn\'t support', function() { |
| 183 | + if (typeof Proxy !== 'undefined' && typeof Reflect !== 'undefined') { |
| 184 | + expect(readNoExistentProperty).to.throw('Invalid Chai property: tue'); |
| 185 | + } else { |
| 186 | + expect(readNoExistentProperty).to.not.throw('Invalid Chai property: tue'); |
| 187 | + } |
| 188 | + }); |
| 189 | + }); |
| 190 | + |
| 191 | + describe('when false', function() { |
| 192 | + it('should not use proxy', function() { |
| 193 | + chai.config.useProxy = false; |
| 194 | + |
| 195 | + expect(readNoExistentProperty).to.not.throw('Invalid Chai property: tue'); |
| 196 | + }); |
| 197 | + }); |
171 | 198 | });
|
172 | 199 | });
|
0 commit comments