source: imaps-frontend/node_modules/globalthis/test/tests.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/* jscs:disable requireUseStrict */
2/* eslint strict: 0, max-statements: 0 */
3
4module.exports = function (theGlobal, t) {
5 t.equal(typeof theGlobal, 'object', 'is an object');
6
7 t.test('built-in globals', function (st) {
8 st.equal(theGlobal.Math, Math, 'Math is on the global');
9 st.equal(theGlobal.JSON, JSON, 'JSON is on the global');
10 st.equal(theGlobal.String, String, 'String is on the global');
11 st.equal(theGlobal.Array, Array, 'Array is on the global');
12 st.equal(theGlobal.Number, Number, 'Number is on the global');
13 st.equal(theGlobal.Boolean, Boolean, 'Boolean is on the global');
14 st.equal(theGlobal.Object, Object, 'Object is on the global');
15 st.equal(theGlobal.Function, Function, 'Function is on the global');
16 st.equal(theGlobal.Date, Date, 'Date is on the global');
17 st.equal(theGlobal.RegExp, RegExp, 'RegExp is on the global');
18
19 if (typeof Symbol === 'undefined') {
20 st.comment('# SKIP Symbol is not supported');
21 } else {
22 st.equal(theGlobal.Symbol, Symbol, 'Symbol is on the global');
23 }
24 st.end();
25 });
26
27 t.test('custom property', function (st) {
28 var key = 'random_custom_key_' + new Date().getTime();
29 var semaphore = {};
30 /* eslint no-eval: 1 */
31 eval(key + ' = semaphore;');
32 st.equal(theGlobal[key], semaphore, 'global variable ends up on the global object');
33 delete theGlobal[key]; // eslint-disable-line no-param-reassign
34 st.end();
35 });
36};
Note: See TracBrowser for help on using the repository browser.