From f66a9fa7f132f41b2e40029f0fb535521c3fb716 Mon Sep 17 00:00:00 2001 From: jw255 Date: Sat, 24 Feb 2018 17:13:43 +0000 Subject: restructuring of tests + yarn install script --- coverage/project-code/src/serverConfig.ts.html | 473 +++++++++++++++++++++++++ 1 file changed, 473 insertions(+) create mode 100644 coverage/project-code/src/serverConfig.ts.html (limited to 'coverage/project-code/src/serverConfig.ts.html') diff --git a/coverage/project-code/src/serverConfig.ts.html b/coverage/project-code/src/serverConfig.ts.html new file mode 100644 index 0000000..16b59f6 --- /dev/null +++ b/coverage/project-code/src/serverConfig.ts.html @@ -0,0 +1,473 @@ + + +
+| 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 | 1x + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +2x +2x +2x +2x + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1x + + + + + + +1x + + + + + + + + +1x + + + + + + + +1x + + + + + + +1x + + + + + + + + + + + + + + +1x + + + + + + + + + + + +1x + | const serverConfig: Property[] = [];
+
+/**
+ * A way to display user-configurable properties.
+ */
+class PropertyDisplay {
+ /**
+ * The category the property belongs to.
+ */
+ public category: string;
+
+ /**
+ * The group the property belongs to.
+ */
+ public group: string;
+
+ /**
+ * The name for the property to display to a user.
+ */
+ public displayName: string;
+
+ /**
+ * The description of the property.
+ */
+ public description: string;
+
+ /**
+ * Constructs a [[PropertyDisplay]] using its properties.
+ *
+ * @param cat The property's category.
+ * @param grp The property's group.
+ * @param dn The property's displayable name.
+ * @param desc A description of the property.
+ */
+ public constructor(cat: string, grp: string, dn: string, desc: string) {
+ this.category = cat;
+ this.group = grp;
+ this.displayName = dn;
+ this.description = desc;
+ }
+}
+
+/**
+ * A server property that infuences the running of the server.
+ * Loaded from configs at launch, and possibly editable during run-time.
+ */
+export interface Property {
+ /**
+ * The property's unique ID.
+ */
+ id: string;
+
+ /**
+ * How to display the property to the user.
+ */
+ display?: PropertyDisplay;
+
+ /**
+ * Is the property read-only, or can it be edited at run-time?
+ */
+ readOnly: boolean;
+
+ /**
+ * The variable type of the property.
+ *
+ * These strings represent Javascript types directly,
+ * except `"integer"`, which is a `number` in logic.
+ */
+ type: 'string' | 'number' | 'integer' | 'boolean';
+
+ /**
+ * The value of the property.
+ */
+ value: string | number | boolean;
+}
+
+// Logging
+let propertyDisplay: PropertyDisplay = new PropertyDisplay(
+ 'Logging',
+ 'BE4',
+ 'Is logging enabled?',
+ 'This property defines if logging is currently enabled on this backend server.'
+);
+
+serverConfig.push({
+ id: 'Server_Log',
+ display: propertyDisplay,
+ readOnly: false,
+ type: 'boolean',
+ value: false
+});
+
+// Caching Settings (global)
+serverConfig.push({
+ id: 'Global_Cache_Limit',
+ readOnly: true,
+ type: 'integer',
+ value: 1
+});
+
+// Caching Settings (project level)
+propertyDisplay = new PropertyDisplay(
+ 'Caching',
+ 'BE4',
+ 'Caching Type',
+ 'This property defines the current caching style for this project.'
+);
+
+serverConfig.push({
+ id: 'project_example',
+ display: propertyDisplay,
+ readOnly: false,
+ type: 'integer',
+ value: 1
+});
+
+/**
+ * Checks if a property exists in the server's property list.
+ *
+ * @param propKey The property unique ID to search for.
+ * @returns The index of the property in the server's property list,
+ * or `-1` if the property is not present.
+ */
+export const propertyExists: (propKey: string) => number =
+ (propKey: string): number => {
+ let found: number = -1;
+ for (const prop in serverConfig) {
+ if (serverConfig[prop].id === propKey) {
+ found = parseInt(prop, 10);
+ break;
+ }
+ }
+ return found;
+};
+
+export default serverConfig;
+ |