gpii-universal
Version:
Cross platform, core components of the GPII personalization infrastructure.
101 lines (88 loc) • 3.53 kB
JavaScript
/*
* MatchMaker Framework Tests
*
* Copyright 2014 Raising the Floor - International
*
* Licensed under the New BSD license. You may not use this file except in
* compliance with this License.
*
* The research leading to these results has received funding from the European Union's
* Seventh Framework Programme (FP7/2007-2013)
* under grant agreement no. 289016.
*
* You may obtain a copy of the License at
* https://github.com/GPII/universal/blob/master/LICENSE.txt
*/
// TODO: This should be converted to a set of browser tests
;
var fluid = require("infusion"),
gpii = fluid.registerNamespace("gpii"),
jqUnit = fluid.require("node-jqunit", require, "jqUnit"),
kettle = fluid.require("kettle", require);
kettle.loadTestingSupport();
require("matchMakerFramework");
fluid.registerNamespace("gpii.tests.matchMakerFramework");
fluid.defaults("gpii.tests.matchMakerFramework.testTree", {
gradeNames: ["fluid.test.testEnvironment"],
components: {
matchMakerFrameworkTester: {
type: "gpii.tests.matchMakerFramework.testCaseHolder"
}
}
});
fluid.defaults("gpii.tests.matchMakerFramework.testCaseHolder", {
gradeNames: ["fluid.test.testCaseHolder"],
modules: [{
name: "gpii.matchMakerFramework tests",
tests: [
{
expect: 1,
name: "filterSolutions tests",
type: "test",
func: "gpii.tests.matchMakerFramework.filterSolutions"
}
]
}]
});
var fullSolutionsRegistry = fluid.require("%gpii-universal/testData/solutions");
gpii.tests.matchMakerFramework.filterSolutionsFixture = [
{
description: "filterSolutions test 1",
device: {
OS: {
id: "win32",
version: "6.8.5"
},
solutions: [
{
"id": "com.microsoft.windows.magnifier"
}, {
"id": "com.microsoft.windows.onscreenKeyboard"
}, {
"id": "org.nvda-project"
}, {
"id": "com.microsoft.windows.highContrast"
}, {
"id": "com.microsoft.windows.mouseTrailing"
}, {
"id": "com.microsoft.windows.cursors"
}
]
},
expected: {
"com.microsoft.windows.magnifier": fullSolutionsRegistry.win32["com.microsoft.windows.magnifier"],
"com.microsoft.windows.onscreenKeyboard": fullSolutionsRegistry.win32["com.microsoft.windows.onscreenKeyboard"],
"org.nvda-project": fullSolutionsRegistry.win32["org.nvda-project"],
"com.microsoft.windows.highContrast": fullSolutionsRegistry.win32["com.microsoft.windows.highContrast"],
"com.microsoft.windows.mouseTrailing": fullSolutionsRegistry.win32["com.microsoft.windows.mouseTrailing"],
"com.microsoft.windows.cursors": fullSolutionsRegistry.win32["com.microsoft.windows.cursors"]
}
}
];
gpii.tests.matchMakerFramework.filterSolutions = function () {
fluid.each(gpii.tests.matchMakerFramework.filterSolutionsFixture, function (fixture) {
var result = gpii.matchMakerFramework.filterSolutions(fullSolutionsRegistry.win32, fixture.device);
jqUnit.assertDeepEq("Expecting the filtered payload", fixture.expected, result);
});
};
module.exports = kettle.test.bootstrap("gpii.tests.matchMakerFramework.testTree");