UNPKG

gpii-universal

Version:

Cross platform, core components of the GPII personalization infrastructure.

113 lines (102 loc) 3.22 kB
/* * Process Reporter Tests * * Copyright 2017 Raising the Floor - International * * Licensed under the New BSD license. You may not use this file except in * compliance with this License. * * You may obtain a copy of the License at * https://github.com/GPII/universal/blob/master/LICENSE.txt */ /* global fluid, jqUnit, gpii */ "use strict"; (function () { fluid.registerNamespace("gpii.tests.processReporter"); fluid.defaults("gpii.tests.processReporter.alwaysTrue", { gradeNames: "fluid.function", argumentMap: {} }); gpii.tests.processReporter.alwaysTrue = function () { return true; }; fluid.defaults("gpii.tests.processReporter.alwaysFalse", { gradeNames: "fluid.function", argumentMap: {} }); gpii.tests.processReporter.alwaysFalse = function () { return false; }; gpii.tests.processReporter.handleIsRunningSpecs = { "No isRunning block": { input: {}, expected: undefined }, "Single true entry as object": { input: { isRunning: { "type": "gpii.tests.processReporter.alwaysTrue" } }, expected: true }, "Single true entry as array": { input: { isRunning: [{ "type": "gpii.tests.processReporter.alwaysTrue" }] }, expected: true }, "Single false entry": { input: { isRunning: [{ "type": "gpii.tests.processReporter.alwaysFalse" }] }, expected: false }, "true + false => false": { input: { isRunning: [{ "type": "gpii.tests.processReporter.alwaysTrue" }, { "type": "gpii.tests.processReporter.alwaysFalse" }] }, expected: false }, "false + true => false": { input: { isRunning: [{ "type": "gpii.tests.processReporter.alwaysFalse" }, { "type": "gpii.tests.processReporter.alwaysTrue" }] }, expected: false }, "true + true => true": { input: { isRunning: [{ "type": "gpii.tests.processReporter.alwaysTrue" }, { "type": "gpii.tests.processReporter.alwaysTrue" }] }, expected: true } }; jqUnit.test("gpii.processReporter.handleIsRunning tests", function () { fluid.each(gpii.tests.processReporter.handleIsRunningSpecs, function (spec, title) { var actual = gpii.processReporter.handleIsRunning(spec.input); jqUnit.assertEquals(title, spec.expected, actual); }); }); jqUnit.test("gpii.processReporter.neverRunning test", function () { jqUnit.assertFalse( "Process Reporter neverRunning()", gpii.processReporter.neverRunning() ); }); })();