gpii-universal
Version:
Cross platform, core components of the GPII personalization infrastructure.
99 lines (87 loc) • 2.82 kB
JavaScript
/*
* INI Settings Handler Tests
*
* Copyright 2018 OCAD University
*
* 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
*/
;
var fluid = require("infusion"),
gpii = fluid.registerNamespace("gpii"),
jqUnit = fluid.registerNamespace("jqUnit"),
kettle = require("kettle");
fluid.registerNamespace("gpii.tests.noSettingsHandler");
kettle.loadTestingSupport();
require("settingsHandlers");
gpii.tests.noSettingsHandler.tests = {
basicTest: {
set: {
payload: {
"com.microsoft.windows.volumeControl": [{
settings: {
"volume": 3
}
}]
},
expected: {
"com.microsoft.windows.volumeControl": [{
options: undefined,
settings: {
"volume": {
newValue: 3,
oldValue: undefined
}
}
}]
}
},
get: {
payload: {
"com.microsoft.windows.volumeControl": [{
settings: {
"volume": {}
}
}]
},
expected: {
"com.microsoft.windows.volumeControl": [{
settings: {
"volume": undefined
}
}]
}
}
}
};
gpii.tests.noSettingsHandler.doTest = function () {
fluid.each(gpii.tests.noSettingsHandler.tests, function (oneTest) {
var getResult = gpii.settingsHandlers.noSettings.get(oneTest.get.payload);
jqUnit.assertDeepEq("The get result is expected", oneTest.get.expected, getResult);
var setResult = gpii.settingsHandlers.noSettings.set(oneTest.set.payload);
jqUnit.assertDeepEq("The set result is expected", oneTest.set.expected, setResult);
});
};
fluid.defaults("gpii.tests.noSettingsHandler", {
gradeNames: ["fluid.test.testEnvironment"],
components: {
tester: {
type: "gpii.tests.noSettingsHandler.testCaseHolder"
}
}
});
fluid.defaults("gpii.tests.noSettingsHandler.testCaseHolder", {
gradeNames: ["fluid.test.testCaseHolder"],
modules: [{
name: "NoSettingsHandler",
tests: [{
// expect: 2,
name: "Tests for gpii.settingsHandler.noSettingsHandler",
func: "gpii.tests.noSettingsHandler.doTest"
}]
}]
});
module.exports = kettle.test.bootstrap("gpii.tests.noSettingsHandler");