@@ 328-357 (lines=30) @@ | ||
325 | } |
|
326 | }); |
|
327 | ||
328 | it("should throw an Error if 'message' or 'code' are invalid parameters", () => { |
|
329 | let arg1, arg2, arg3, test31, test32, test33, test21, test22, test11; |
|
330 | const noStr = [{}, true, false, 42, 3.1416, -42, -3.1416, () => null]; |
|
331 | const noNmb = [{}, true, false, '', "qwerty", () => null]; |
|
332 | test33 = (() => new Klass(arg1, arg2, arg3)); |
|
333 | test32 = (() => new Klass(null, arg2, arg3)); |
|
334 | test31 = (() => new Klass(null, null, arg3)); |
|
335 | test22 = (() => new Klass(arg1, arg2)); |
|
336 | test21 = (() => new Klass(null, arg2)); |
|
337 | test11 = (() => new Klass(arg1)); |
|
338 | if (typeof Symbol === "function") { |
|
339 | noStr.push(Symbol("symbol")); |
|
340 | noNmb.push(Symbol("symbol")); |
|
341 | } |
|
342 | for (let i = 0; i < noStr.length; i += 1) { |
|
343 | arg1 = noStr[i]; |
|
344 | expect(test11).toThrowError("parameter 'name' must be a 'string'"); |
|
345 | for (let j = 0; j < noStr.length; j += 1) { |
|
346 | arg2 = noStr[j]; |
|
347 | expect(test22).toThrowError("parameter 'name' must be a 'string'"); |
|
348 | expect(test21).toThrowError("parameter 'message' must be a 'string'"); |
|
349 | for (let e = 0; e < noNmb.length; e += 1) { |
|
350 | arg3 = noNmb[e]; |
|
351 | expect(test33).toThrowError("parameter 'name' must be a 'string'"); |
|
352 | expect(test32).toThrowError("parameter 'message' must be a 'string'"); |
|
353 | expect(test31).toThrowError("parameter 'code' must be a 'number'"); |
|
354 | } |
|
355 | } |
|
356 | } |
|
357 | }); |
|
358 | ||
359 | // :: MEMBER PROPERTIES |
|
360 | ||
@@ 183-203 (lines=21) @@ | ||
180 | } |
|
181 | }); |
|
182 | ||
183 | it("should throw an Error if 'message' or 'code' are invalid parameters", () => { |
|
184 | let arg1, arg2, arg3, test21, test22, test11; |
|
185 | const noStr = [{}, true, false, 42, 3.1416, -42, -3.1416, () => null]; |
|
186 | const noNmb = [{}, true, false, '', "qwerty", () => null]; |
|
187 | test22 = (() => new Klass(arg1, arg2)); |
|
188 | test21 = (() => new Klass(null, arg2)); |
|
189 | test11 = (() => new Klass(arg1)); |
|
190 | if (typeof Symbol === "function") { |
|
191 | noStr.push(Symbol("symbol")); |
|
192 | noNmb.push(Symbol("symbol")); |
|
193 | } |
|
194 | for (let i = 0; i < noStr.length; i += 1) { |
|
195 | arg1 = noStr[i]; |
|
196 | expect(test11).toThrowError("parameter 'message' must be a 'string'"); |
|
197 | for (let j = 0; j < noNmb.length; j += 1) { |
|
198 | arg2 = noNmb[j]; |
|
199 | expect(test22).toThrowError("parameter 'message' must be a 'string'"); |
|
200 | expect(test21).toThrowError("parameter 'code' must be a 'number'"); |
|
201 | } |
|
202 | } |
|
203 | }); |
|
204 | ||
205 | // :: MEMBER PROPERTIES |
|
206 |