Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-11-19 11:10:16 -0500
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-11-19 11:10:16 -0500
commitf9f7cebce75c0afc7bf55daa2c7060cc0c233304 (patch)
treea0216a1910700b2acf757c749730e51d9476785b /test
parentb96479409c0f58eae581b25c13c80f55f88e6ddd (diff)
downloadliza-f9f7cebce75c0afc7bf55daa2c7060cc0c233304.tar.gz
liza-f9f7cebce75c0afc7bf55daa2c7060cc0c233304.tar.bz2
liza-f9f7cebce75c0afc7bf55daa2c7060cc0c233304.zip
Accommodate ancient qtype data on init and clean
* src/program/ProgramInit.js (_isKnownType): Account for ancient qtype representation (as a string). * src/server/quote/ProgramQuoteCleaner.js (_isKnownType): Likewise. * test/program/ProgramInitTest.js: New test case for this situation. * test/server/quote/ProgramQuoteCleanerTest.js: Modify existing test case for this situation.
Diffstat (limited to 'test')
-rw-r--r--test/program/ProgramInitTest.js21
-rw-r--r--test/server/quote/ProgramQuoteCleanerTest.js4
2 files changed, 24 insertions, 1 deletions
diff --git a/test/program/ProgramInitTest.js b/test/program/ProgramInitTest.js
index 02cea98..79c78f7 100644
--- a/test/program/ProgramInitTest.js
+++ b/test/program/ProgramInitTest.js
@@ -50,6 +50,27 @@ describe( 'ProgramInit', () =>
b: [ "two" ],
},
},
+ // for ancient versions of liza-proguic (before it was even called
+ // "liza")
+ {
+ label: "initializes defaults for ancient data representations",
+ defaults: { a: "one", b: "two" },
+ meta: {
+ groups: {},
+ qtypes: {
+ a: "noyes",
+ b: "noyes",
+ },
+ },
+ groupExclusiveFields: {
+ Something: [ "a", "b" ]
+ },
+ doc_data: {},
+ expected: {
+ a: [ "one" ],
+ b: [ "two" ],
+ },
+ },
{
label: "does nothing with no data or defaults",
defaults: {},
diff --git a/test/server/quote/ProgramQuoteCleanerTest.js b/test/server/quote/ProgramQuoteCleanerTest.js
index 957f7ae..180cbf6 100644
--- a/test/server/quote/ProgramQuoteCleanerTest.js
+++ b/test/server/quote/ProgramQuoteCleanerTest.js
@@ -55,7 +55,9 @@ describe( 'ProgramQuoteCleaner', () =>
"field21": { type: "text" },
"field22": { type: "text" },
"field31": { type: "text" },
- "field32": { type: "text" },
+
+ // ancient pre-"liza" data representation
+ "field32": "text",
},
existing: {