Files
dc/sas/mocks/sasjs/services/public/getddl.js
T
dc 86c8a1a76f
Build / Build-and-ng-test (pull_request) Successful in 5m1s
Lighthouse Checks / lighthouse (pull_request) Successful in 18m37s
Build / Build-and-test-development (pull_request) Failing after 29m22s
test(download): reload the approve screen until the submitted row appears
The upload and submit now work; the failure moved to the approve grid, which is
loaded when the screen opens and does not yet contain the row just submitted.
The screen is reloaded up to five times, two seconds apart, until the row with
this test's id is present.

The mock getddl aborts when ds is missing, as production does (getddl.sas:43-45),
instead of quietly returning a library-level DDL - a client that dropped ds would
otherwise stay green against the mocks.

The comment above the case no longer claims a leftover row cannot matter: the
grid paginates, so a row pushed past the first page would not be found.
2026-10-31 13:19:04 +00:00

40 lines
1.4 KiB
JavaScript

let mimeType = `application/octet-stream`
let filename = `dc-download`
/* typeof, not a truthiness test: if the service is called without a ds in scope
the read itself throws and the fallback never runs */
if (
typeof libref !== 'undefined' &&
libref &&
typeof ds !== 'undefined' &&
ds
)
filename = `${libref}_${ds}.ddl`
else if (typeof libref !== 'undefined' && libref) {
/* production aborts when ds is missing (getddl.sas:43-45), so the mock does
too: a client that dropped ds would otherwise stay green here */
throw new Error(`Dataset ${libref}..${ds} was not found`)
}
fs.writeFile(_SASJS_WEBOUT_HEADERS, `Content-type: ${mimeType} \n Content-Disposition: attachment;filename=\"${filename}\"`, function (err) {
if (err) throw err;
})
_webout = `/* DDL generated by sassrv on 29SEP2022:11:59:44 */
CREATE SCHEMA DC_JSLIB;
/* Postgres Flavour DDL for DC_JSLIB.MPE_X_TEST */
CREATE TABLE DC_JSLIB.MPE_X_TEST (
"primary_key_field" DOUBLE PRECISION NOT NULL
,"some_char" VARCHAR(32767)
,"some_dropdown" VARCHAR(128)
,"some_num" DOUBLE PRECISION
,"some_date" DOUBLE PRECISION
,"some_datetime" TIMESTAMP
,"some_time" DOUBLE PRECISION
,"some_shortnum" DOUBLE PRECISION
,"some_bestnum" DOUBLE PRECISION
);
CREATE UNIQUE INDEX "primary_key_field" ON DC_JSLIB.MPE_X_TEST(
"primary_key_field"
);
`