-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathSolutionsUtilsTests.js
More file actions
153 lines (144 loc) · 4.64 KB
/
SolutionsUtilsTests.js
File metadata and controls
153 lines (144 loc) · 4.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
* Tests for GPII Solutions Utils
*
* Copyright 2019 Raising the Floor - US
*
* 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
*/
"use strict";
var fluid = require("infusion");
var gpii = fluid.registerNamespace("gpii");
var jqUnit = require("node-jqunit");
require("../src/js/SolutionsUtils");
jqUnit.module("Tests for Solutions Registry Utility functions.");
fluid.registerNamespace("gpii.tests.universal.solutionsRegistry.solutionsUtils");
gpii.tests.universal.solutionsRegistry.solutionsUtils.defaultValueTests = [
{
schema: {
"title": "Attribute Rotation Delay",
"description": "When in Attribute...",
"type": "integer",
"default": 1000
},
result: {
hasDefault: true,
type: "integer",
default: 1000
}
},
{
schema: {
"title": "Attribute Rotation Delay",
"description": "When in Attribute...",
"default": 1000
},
result: {
hasDefault: true,
default: 1000
}
},
{
schema: {
"title": "Attribute Rotation Delay With No Default...",
"description": "When in Attribute...",
"type": "integer"
},
result: {
hasDefault: false
}
},
{
schema: {
"title": "Desktop background wallpaper",
"description": "The path to the image to be set as the new desktop wallpaper.",
"properties": {
"path": { "type": "string"},
"value": {
"type": "string",
"default": "%SystemRoot%\\Web\\Wallpaper\\Windows\\img0.jpg"
}
}
},
result: {
hasDefault: true,
type: "string",
default: "%SystemRoot%\\Web\\Wallpaper\\Windows\\img0.jpg"
}
},
{
schema: {
"title": "Desktop background wallpaper",
"description": "The path to the image to be set as the new desktop wallpaper.",
"properties": {
"path": { "type": "string"},
"value": {
"default": "%SystemRoot%\\Web\\Wallpaper\\Windows\\img0.jpg"
}
}
},
result: {
hasDefault: true,
default: "%SystemRoot%\\Web\\Wallpaper\\Windows\\img0.jpg"
}
},
{
schema: {
"title": "Desktop background wallpaper",
"description": "The path to the image to be set as the new desktop wallpaper.",
"properties": {
"path": { "type": "string", "required": true},
"value": {
"type": "string",
"required": true,
"default": ""
}
}
},
result: {
hasDefault: true,
type: "string",
default: ""
}
},
{
schema: {
"title": "Screen mirroring",
"description": "Mirrors the primary screen into a secondary screen.",
"type": "boolean",
"default": false
},
result: {
hasDefault: true,
type: "boolean",
default: false
}
}
];
gpii.tests.universal.solutionsRegistry.solutionsUtils.findDefaultValueTest = function (schema, expectedResult) {
var result = gpii.universal.solutionsRegistry.findDefaultValue(schema);
jqUnit.assertDeepEq("Checking default value for: " + schema.title, expectedResult, result);
};
gpii.tests.universal.solutionsRegistry.solutionsUtils.findDefaultValueTests = function () {
jqUnit.test("Testing my empty stubs...", function () {
fluid.each(gpii.tests.universal.solutionsRegistry.solutionsUtils.defaultValueTests, function (item) {
gpii.tests.universal.solutionsRegistry.solutionsUtils.findDefaultValueTest(item.schema, item.result);
});
});
};
fluid.defaults("gpii.tests.universal.solutionsRegistry.solutionsUtils", {
gradeNames: ["fluid.component"],
listeners: {
"onCreate.findDefaultValueTest": {
funcName: "gpii.tests.universal.solutionsRegistry.solutionsUtils.findDefaultValueTests"
}
}
});
gpii.tests.universal.solutionsRegistry.solutionsUtils();