Skip to content

Commit

Permalink
refactor(tests): update gw_fct_pg2epa_main tests to use consistent 'r…
Browse files Browse the repository at this point in the history
…esultId' and expand test coverage from 1 to 7 steps on ws
  • Loading branch information
danimarinBG committed Jan 22, 2025
1 parent a3640a3 commit fcddb17
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 11 deletions.
14 changes: 7 additions & 7 deletions test/plsql/ud/test_gw_fct_pg2epa_main.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,49 +16,49 @@ SELECT plan(7);
-- Extract and test the "status" field from the function's JSON response
SELECT is(
(gw_fct_pg2epa_main($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"expl_1", "dumpSubcatch":"False", "step": 1}}$$)::JSON)->>'status',
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"testing", "dumpSubcatch":"False", "step": 1}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_pg2epa_main: dumpSubcatch=False | step=1 returns status "Accepted"'
);

SELECT is(
(gw_fct_pg2epa_main($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"expl_1", "dumpSubcatch":"False", "step": 2}}$$)::JSON)->>'status',
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"testing", "dumpSubcatch":"False", "step": 2}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_pg2epa_main: dumpSubcatch=False | step=2 returns status "Accepted"'
);

SELECT is(
(gw_fct_pg2epa_main($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"expl_1", "dumpSubcatch":"False", "step": 3}}$$)::JSON)->>'status',
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"testing", "dumpSubcatch":"False", "step": 3}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_pg2epa_main: dumpSubcatch=False | step=3 returns status "Accepted"'
);

SELECT is(
(gw_fct_pg2epa_main($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"expl_1", "dumpSubcatch":"False", "step": 4}}$$)::JSON)->>'status',
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"testing", "dumpSubcatch":"False", "step": 4}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_pg2epa_main: dumpSubcatch=False | step=4 returns status "Accepted"'
);

SELECT is(
(gw_fct_pg2epa_main($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"expl_1", "dumpSubcatch":"False", "step": 5}}$$)::JSON)->>'status',
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"testing", "dumpSubcatch":"False", "step": 5}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_pg2epa_main: dumpSubcatch=False | step=5 returns status "Accepted"'
);

SELECT is(
(gw_fct_pg2epa_main($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"expl_1", "dumpSubcatch":"False", "step": 6}}$$)::JSON)->>'status',
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"testing", "dumpSubcatch":"False", "step": 6}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_pg2epa_main: dumpSubcatch=False | step=6 returns status "Accepted"'
);

SELECT is(
(gw_fct_pg2epa_main($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"expl_1", "dumpSubcatch":"False", "step": 7}}$$)::JSON)->>'status',
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"testing", "dumpSubcatch":"False", "step": 7}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_pg2epa_main: dumpSubcatch=False | step=7 returns status "Accepted"'
);
Expand Down
50 changes: 46 additions & 4 deletions test/plsql/ws/test_gw_fct_pg2epa_main.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,57 @@ SET client_min_messages TO WARNING;

SET search_path = "SCHEMA_NAME", public, pg_catalog;

-- Plan for 1 test
SELECT plan(1);
-- Plan for 7 test
SELECT plan(7);

-- Extract and test the "status" field from the function's JSON response
SELECT is(
(gw_fct_pg2epa_main($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"test0", "step": 2}}$$)::JSON)->>'status',
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"testing", "dumpSubcatch":"False", "step": 1}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_pg2epa_main returns status "Accepted"'
'Check if gw_fct_pg2epa_main: dumpSubcatch=False | step=1 returns status "Accepted"'
);

SELECT is(
(gw_fct_pg2epa_main($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"testing", "dumpSubcatch":"False", "step": 2}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_pg2epa_main: dumpSubcatch=False | step=2 returns status "Accepted"'
);

SELECT is(
(gw_fct_pg2epa_main($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"testing", "dumpSubcatch":"False", "step": 3}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_pg2epa_main: dumpSubcatch=False | step=3 returns status "Accepted"'
);

SELECT is(
(gw_fct_pg2epa_main($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"testing", "dumpSubcatch":"False", "step": 4}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_pg2epa_main: dumpSubcatch=False | step=4 returns status "Accepted"'
);

SELECT is(
(gw_fct_pg2epa_main($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"testing", "dumpSubcatch":"False", "step": 5}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_pg2epa_main: dumpSubcatch=False | step=5 returns status "Accepted"'
);

SELECT is(
(gw_fct_pg2epa_main($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"testing", "dumpSubcatch":"False", "step": 6}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_pg2epa_main: dumpSubcatch=False | step=6 returns status "Accepted"'
);

SELECT is(
(gw_fct_pg2epa_main($${"client":{"device":4, "lang":"", "infoType":1, "epsg":25831}, "form":{}, "feature":{},
"data":{"filterFields":{}, "pageInfo":{}, "resultId":"testing", "dumpSubcatch":"False", "step": 7}}$$)::JSON)->>'status',
'Accepted',
'Check if gw_fct_pg2epa_main: dumpSubcatch=False | step=7 returns status "Accepted"'
);

-- Finish the test
Expand Down

0 comments on commit fcddb17

Please sign in to comment.