{"id":17677791,"url":"https://github.com/adamslack/handlebars-express-testing","last_synced_at":"2026-03-19T01:45:38.513Z","repository":{"id":122722987,"uuid":"479728131","full_name":"AdamSlack/handlebars-express-testing","owner":"AdamSlack","description":"Example of unit testing handlebars with express like you might test a react component.","archived":false,"fork":false,"pushed_at":"2022-05-26T16:01:19.000Z","size":9081,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-05T20:06:19.149Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AdamSlack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-09T13:03:18.000Z","updated_at":"2022-04-09T13:04:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"8c2ab094-f3bc-4d3f-8894-66acc637c859","html_url":"https://github.com/AdamSlack/handlebars-express-testing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdamSlack%2Fhandlebars-express-testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdamSlack%2Fhandlebars-express-testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdamSlack%2Fhandlebars-express-testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdamSlack%2Fhandlebars-express-testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AdamSlack","download_url":"https://codeload.github.com/AdamSlack/handlebars-express-testing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246358251,"owners_count":20764366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-24T07:41:51.982Z","updated_at":"2026-01-11T02:41:36.777Z","avatar_url":"https://github.com/AdamSlack.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Handlebars Express Testing\n\nThis is a sample project showing how you might test a handlebars w/ express app.\n\nExample tests approach 2 different angles.\n\n1. Testing the result of the express endpoints\n2. Testing only a rendered template\n\nTemplates rendered via express and then returned from an API request use supertest to simulate the running and calling of the API.\n\nTemplates rendered separately to the API use the handlebars engine directly.\n\nTests both with and without express being involved use `cheerio` to allow you to query the rendered string.\n\nThis project levereages:\n- `supertest` to simulate invoking express endpoints\n- `cheerio` to load rendered HTML into a format easy to query\n- `jest` to structure and run tests\n\n## Getting started\n\nInstall dependencies: `npm install`\n\nRun the tests: `npm run test`\n\nInspect the output in your console.\n\n## Project structure\n\nThe express app has views and controllers.\n\nThe Controllers will pick a view to render and return that.\n\nTHe views consist of handlebars templates that will end up being rendered.\n\n## Importing Handlebars Template Files\n\nThis project has a util function that will read the template using node's `fs` api. To allow the util to be imported and used from anywhere. The npm package `callsite` is used.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamslack%2Fhandlebars-express-testing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadamslack%2Fhandlebars-express-testing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamslack%2Fhandlebars-express-testing/lists"}