From c8ac7b14a584f92477403a38bef583ce410ab6c8 Mon Sep 17 00:00:00 2001 From: matteo-cristino Date: Fri, 18 Apr 2025 11:55:12 +0200 Subject: [PATCH] fix(db): update db statement format to not conflict with the new statements format --- examples/db/sql_statement_with_params.slang | 2 +- pkg/db/src/plugin.ts | 2 +- pkg/db/test/raw_query.ts | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/db/sql_statement_with_params.slang b/examples/db/sql_statement_with_params.slang index 4609bc7f..f10f4e44 100644 --- a/examples/db/sql_statement_with_params.slang +++ b/examples/db/sql_statement_with_params.slang @@ -1,6 +1,6 @@ Rule unknown ignore -Given I connect to 'database' and send statement 'statement' and send parameters 'parameters' and execute sql statement with parameters and output into 'result' +Given I connect to 'database' and send statement 'statement' and send parameters 'parameters' and execute parametrized sql statement and output into 'result' Given I have a 'string dictionary' named 'result' Then print the 'result' diff --git a/pkg/db/src/plugin.ts b/pkg/db/src/plugin.ts index b8b11b96..a9d7af53 100644 --- a/pkg/db/src/plugin.ts +++ b/pkg/db/src/plugin.ts @@ -105,7 +105,7 @@ export const execute = p.new('connect', export const executeParams = p.new('connect', ['statement', 'parameters'], - 'execute sql statement with parameters', + 'execute parametrized sql statement', async (ctx) => { const statement = ctx.fetch('statement') as string; const parameters = ctx.fetch('parameters') as BindOrReplacements; diff --git a/pkg/db/test/raw_query.ts b/pkg/db/test/raw_query.ts index da0ab480..523283b0 100644 --- a/pkg/db/test/raw_query.ts +++ b/pkg/db/test/raw_query.ts @@ -18,8 +18,8 @@ test('Db should execute raw queries', async (t) => { Given I connect to 'database' and send statement 'query_2' and execute sql statement and output into 'result_2' Given I connect to 'database' and send statement 'query_3' and execute sql statement and output into 'result_3' Given I connect to 'database' and send statement 'query_4' and execute sql statement and output into 'result_4' - Given I connect to 'database' and send statement 'query_5' and send parameters 'query5_params' and execute sql statement with parameters and output into 'result_5' - Given I connect to 'database' and send statement 'query_6' and send parameters 'query6_params' and execute sql statement with parameters and output into 'result_6' + Given I connect to 'database' and send statement 'query_5' and send parameters 'query5_params' and execute parametrized sql statement and output into 'result_5' + Given I connect to 'database' and send statement 'query_6' and send parameters 'query6_params' and execute parametrized sql statement and output into 'result_6' Given I have a 'string dictionary' named 'result_1' Given I have a 'string dictionary' named 'result_2' Given I have a 'string dictionary' named 'result_3' @@ -85,7 +85,7 @@ test('Db should execute raw queries', async (t) => { test('Db should fail for wrong database', async (t) => { const rawQuery = `Rule unknown ignore Given I connect to 'database' and send statement 'query_1' and execute sql statement and output into 'result_1' - Given I connect to 'database' and send statement 'query_5' and send parameters 'query5_params' and execute sql statement with parameters and output into 'result_5' + Given I connect to 'database' and send statement 'query_5' and send parameters 'query5_params' and execute parametrized sql statement and output into 'result_5' Given I have a 'string dictionary' named 'result_1' Given I have a 'string dictionary' named 'result_5' Then print all data @@ -105,7 +105,7 @@ test('Db should fail for wrong database', async (t) => { `0 | Rule unknown ignore 1 | Given I connect to 'database' and send statement 'query_1' and execute sql statement and output into 'result_1' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -2 | Given I connect to 'database' and send statement 'query_5' and send parameters 'query5_params' and execute sql statement with parameters and output into 'result_5' +2 | Given I connect to 'database' and send statement 'query_5' and send parameters 'query5_params' and execute parametrized sql statement and output into 'result_5' 3 | Given I have a 'string dictionary' named 'result_1' Error colors: @@ -132,7 +132,7 @@ Heap: test('Db should fail for wrong statement', async (t) => { const rawQuery = `Rule unknown ignore Given I connect to 'database' and send statement 'query_1' and execute sql statement and output into 'result_1' - Given I connect to 'database' and send statement 'query_5' and send parameters 'query5_params' and execute sql statement with parameters and output into 'result_5' + Given I connect to 'database' and send statement 'query_5' and send parameters 'query5_params' and execute parametrized sql statement and output into 'result_5' Given I have a 'string dictionary' named 'result_1' Given I have a 'string dictionary' named 'result_5' Then print all data @@ -152,7 +152,7 @@ test('Db should fail for wrong statement', async (t) => { `0 | Rule unknown ignore 1 | Given I connect to 'database' and send statement 'query_1' and execute sql statement and output into 'result_1' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -2 | Given I connect to 'database' and send statement 'query_5' and send parameters 'query5_params' and execute sql statement with parameters and output into 'result_5' +2 | Given I connect to 'database' and send statement 'query_5' and send parameters 'query5_params' and execute parametrized sql statement and output into 'result_5' 3 | Given I have a 'string dictionary' named 'result_1' Error colors: