MOON
Server: Apache
System: Linux 54-179-220-51.cprapid.com 3.10.0-1160.144.1.el7.tuxcare.els4.x86_64 #1 SMP Tue Apr 7 08:40:40 UTC 2026 x86_64
User: thehunarfound (1001)
PHP: 7.4.29
Disabled: NONE
Upload Files
File: /home/thehunarfound/public_html/DMS/node_modules/es5-ext/test/promise/lazy.js
"use strict";

module.exports = function (t) {
	if (typeof Promise !== "function") return null; // Run tests only in ES2015+ env

	return {
		"Delays execution": function (a, d) {
			var invoked = false;
			var promise = t(function (resolve) {
				invoked = true;
				setTimeout(function () { resolve(20); }, 10);
			});

			a(invoked, false);

			setTimeout(function () {
				a(invoked, false);
				promise.then(function (value) {
					a(value, 20);
					setTimeout(d, 0); // Escape error swallowing
				});
				a(invoked, true);
			}, 15);
		},
		"Passes rejection": function (a, d) {
			var promise = t(function (resolve, reject) {
				setTimeout(function () { reject(new Error("Stop")); }, 10);
			});

			promise.catch(function (error) {
				a(error instanceof Error, true);
				a(error.message, "Stop");
				setTimeout(d, 0); // Escape error swallowing
			});
		},
		"Passes sync exception": function (a, d) {
			var promise = t(function () { throw new Error("Stop"); });

			promise.catch(function (error) {
				a(error instanceof Error, true);
				a(error.message, "Stop");
				setTimeout(d, 0); // Escape error swallowing
			});
		}
	};
};
;;