diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a5c830a --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# compiled code & logs +**/target/ +**/logs/ +# package folder +**/dbt_packages/ +# dbt folders that are not used +**/snapshots/ +**/analysis/ +**/data/ +# user specific file +**/.user.yml + +# MacOS specific files +.DS_Store diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml new file mode 100644 index 0000000..8158b70 --- /dev/null +++ b/integration_tests/dbt_project.yml @@ -0,0 +1,5 @@ +name: 'pm_utils_integration_tests' +version: '1.0.0' +config-version: 2 + +profile: 'integration_tests' diff --git a/integration_tests/macros/tests.sql b/integration_tests/macros/tests.sql new file mode 100644 index 0000000..e65a640 --- /dev/null +++ b/integration_tests/macros/tests.sql @@ -0,0 +1,3 @@ +{% test equal_value(model, actual, expected) %} + select * from {{ model }} where {{ actual }} != {{ expected }} +{% endtest %} diff --git a/integration_tests/models/schema.yml b/integration_tests/models/schema.yml new file mode 100644 index 0000000..232ff2b --- /dev/null +++ b/integration_tests/models/schema.yml @@ -0,0 +1,11 @@ +version: 2 + +models: + - name: test_concat + tests: + - equal_value: + actual: '"Two_text_fields"' + expected: '"Two_text_fields_expected"' + - equal_value: + actual: '"One_null"' + expected: '"One_null_expected"' diff --git a/integration_tests/models/test_concat.sql b/integration_tests/models/test_concat.sql new file mode 100644 index 0000000..cc8a71b --- /dev/null +++ b/integration_tests/models/test_concat.sql @@ -0,0 +1,16 @@ +with Input_data as ( + select + 'A' as "Column_A", + 'B' as "Column_B", + null as "Column_C" +) + +select + {# Concatenate two text fields (basic scenario) #} + {{ pm_utils.concat('"Column_A"', '"Column_B"') }} as "Two_text_fields", + 'AB' as "Two_text_fields_expected", + + {# Concatenate two fields of which one is null #} + {{ pm_utils.concat('"Column_A"', '"Column_C"') }} as "One_null", + 'A' as "One_null_expected" +from Input_data diff --git a/integration_tests/packages.yml b/integration_tests/packages.yml new file mode 100644 index 0000000..4a6b9c1 --- /dev/null +++ b/integration_tests/packages.yml @@ -0,0 +1,2 @@ +packages: + - local: ../