Skip to content

Commit

Permalink
Merge pull request #36 from Crown-Commercial-Service/add-test-to-make…
Browse files Browse the repository at this point in the history
…-sure-all-components-have-been-added

Add test to make sure all helpers from the node package are present
  • Loading branch information
tim-s-ccs authored Apr 8, 2024
2 parents 1e70f41 + 0bfe1be commit 707d513
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,23 @@ def test_render_component(client, component_name, macro_name, fixture_name, fixt
), f"Did not match for '{component_name}' component with example: '{fixture_name}'"


def test_all_jinja_templates_exist():
excluded_components = ['follow-up-question-example']

jinja_components = [component for component in get_components()]

nunjucks_components = []

paths = glob.glob(f'{DM_COMPONENTS_NODE_DIR}/*/macro.njk')
for path in paths:
component_name = path.split('/')[4]

if component_name not in excluded_components:
nunjucks_components.append(component_name)

assert jinja_components == nunjucks_components


# # Debugging test case for testing one component
# @pytest.mark.parametrize("macro_name, fixture_name, fixture_options, fixture_html", component_fixtures(''))
# def test_component(client, macro_name, fixture_name, fixture_options, fixture_html):
Expand Down

0 comments on commit 707d513

Please sign in to comment.