gpii-universal
Version:
Cross platform, core components of the GPII personalization infrastructure.
69 lines (63 loc) • 2.29 kB
JavaScript
;
var fluid = require("infusion");
var gpii = fluid.registerNamespace("gpii");
require("./lib/utils");
var jqUnit = require("node-jqunit");
jqUnit.module("Unit tests for test utilities.");
jqUnit.test("Test `hasIntraApplicationTransform` utility function.", function () {
var testDefs = {
shallowMatch: {
shouldMatch: true,
toCheck: "http://registry.gpii.net/applications/com.microsoft.windows.desktopBackground.Scaling"
},
escapedMatch: {
shouldMatch: true,
toCheck: "http://registry\\.gpii\\.net/applications/com\\.microsoft\\.windows\\.desktopBackground.Scaling"
},
shallowMiss: {
toCheck: "http://registry.gpii.net/common/cursorSize"
},
shallowEscapedMiss: {
toCheck: "http://registry\\.gpii\\.net/common/cursorSize"
},
deepHit: {
shouldMatch: true,
toCheck: {
deep: {
deeper: {
deepest: "http://registry.gpii.net/applications/com.microsoft.windows.desktopBackground.Scaling"
}
}
}
},
deepEscapedHit: {
shouldMatch: true,
toCheck: {
deep: {
deeper: {
deepest: "http://registry\\.gpii\\.net/applications/com\\.microsoft\\.windows\\.desktopBackground.Scaling"
}
}
}
},
deepMiss: {
toCheck: {
one: {
two: "http://registry.gpii.net/common/cursorSize"
}
}
},
deepEscapedMiss: {
toCheck: {
outer: {
inner: "http://registry\\.gpii\\.net/common/cursorSize"
}
}
}
};
fluid.each(testDefs, function (testDef, testDefKey) {
var hasIntraApplicationTransform = gpii.tests.universal.solutionsRegistry.hasIntraApplicationTransform(testDef.toCheck);
var testFn = testDef.shouldMatch ? "assertTrue" : "assertFalse";
jqUnit[testFn]("The output for " + testDefKey + " should be as expected.", hasIntraApplicationTransform);
});
});