-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new unit tests for dbt models and macros
- Loading branch information
1 parent
f8ba41c
commit b872658
Showing
30 changed files
with
20,121 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% macro format_float_value(value) %} | ||
|
||
{% if target.name != 'prod' %} | ||
CAST({{value}} as Float32) | ||
{% else %} | ||
{{ value }} | ||
{% endif %} | ||
|
||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% macro source_for_test(schema,table) %} | ||
|
||
{% if target.name != 'prod' %} | ||
{{ source(target.schema,table)}} | ||
{% else %} | ||
{{ source(schema,table) }} | ||
{% endif %} | ||
|
||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
unit_tests: | ||
- name: test_fact_enrollments | ||
model: fact_enrollments | ||
config: | ||
tags: 'ci' | ||
given: | ||
- input: ref('course_names') | ||
format: sql | ||
rows: | | ||
select * from course_names | ||
- input: ref('enrollment_events') | ||
format: sql | ||
rows: | | ||
select * from enrollment_events | ||
- input: ref('dim_user_pii') | ||
format: sql | ||
rows: | | ||
select * from dim_user_pii | ||
expect: | ||
format: sql | ||
rows: | | ||
select * from fact_enrollments_expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
unit_tests: | ||
- name: test_fact_grades | ||
model: fact_grades | ||
config: | ||
tags: 'ci' | ||
given: | ||
- input: ref('grading_events') | ||
format: sql | ||
rows: | | ||
select * from grading_events | ||
- input: ref('course_block_names') | ||
format: sql | ||
rows: | | ||
select * from course_block_names | ||
- input: ref('dim_user_pii') | ||
format: sql | ||
rows: | | ||
select * from dim_user_pii | ||
- input: ref('course_names') | ||
format: sql | ||
rows: | | ||
select * from course_names | ||
expect: | ||
format: sql | ||
fixture: fact_grades_expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
unit_tests: | ||
- name: test_macro_items_per_subsection | ||
model: int_pages_per_subsection | ||
config: | ||
tags: 'ci' | ||
given: | ||
- input: ref('dim_course_blocks') | ||
format: sql | ||
rows: | | ||
select * from dim_course_blocks | ||
expect: | ||
format: sql | ||
rows: | | ||
select * from items_per_subsection_expected | ||
- name: test_fact_navigation_dropoff | ||
model: fact_navigation_dropoff | ||
config: | ||
tags: 'ci' | ||
given: | ||
- input: ref('dim_course_blocks') | ||
format: sql | ||
rows: | | ||
select * from dim_course_blocks | ||
- input: ref('fact_navigation') | ||
format: sql | ||
rows: | | ||
select * from fact_navigation | ||
- input: ref('dim_user_pii') | ||
format: sql | ||
rows: | | ||
select * from dim_user_pii | ||
expect: | ||
format: sql | ||
rows: | | ||
select * from fact_navigation_dropoff_expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.