{"id":16445840,"url":"https://github.com/sporeball/tentamen","last_synced_at":"2025-10-27T05:32:01.363Z","repository":{"id":64309631,"uuid":"387592970","full_name":"sporeball/tentamen","owner":"sporeball","description":"a tiny JavaScript testing framework","archived":false,"fork":false,"pushed_at":"2022-12-06T06:56:55.000Z","size":38,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-10T03:09:01.250Z","etag":null,"topics":["node","testing"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sporeball.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-19T21:01:06.000Z","updated_at":"2022-12-05T04:51:50.000Z","dependencies_parsed_at":"2023-01-15T11:15:48.729Z","dependency_job_id":null,"html_url":"https://github.com/sporeball/tentamen","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sporeball%2Ftentamen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sporeball%2Ftentamen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sporeball%2Ftentamen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sporeball%2Ftentamen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sporeball","download_url":"https://codeload.github.com/sporeball/tentamen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238445869,"owners_count":19473826,"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":["node","testing"],"created_at":"2024-10-11T09:45:34.640Z","updated_at":"2025-10-27T05:31:56.023Z","avatar_url":"https://github.com/sporeball.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tentamen\n\n\u003ca href=\"https://www.npmjs.com/package/tentamen\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/tentamen\" /\u003e\u003c/a\u003e\n\n**tentamen** is a tiny (less than 50 source lines of code) JavaScript testing framework, just perfect for making sure that a function gives the right return values.\\\nit uses deep equality, so you can easily test against things like arrays, objects, [and even error instances.](#on-tests-and-errors)\n\n\n### install\n```\nnpm i --save tentamen\n```\n\n### usage\n```js\nimport Tentamen from 'tentamen';\nlet tentamen = new Tentamen({\n  fn: str =\u003e str.startsWith('a')\n});\n\ntentamen.suite('truthy cases');\ntentamen.add('absolutely', 'absolutely', true);\ntentamen.add('acknowledge', 'acknowledge', true);\n\ntentamen.suite('falsy cases');\ntentamen.add('tentamen', 'tentamen', false);\ntentamen.add('percentage', 'percentage', false);\n\ntentamen.done();\n```\n```\n$ node test.js\ntruthy cases\n  o  absolutely\n  o  acknowledge\nfalsy cases\n  o  tentamen\n  o  percentage\n\n4 of 4 tests passing\n```\n\n## API\n\n### new Tentamen(obj)\n\n#### obj\ntype: `object`\n\n##### fn\ntype: `function`\n\nthe function to run tests on.\n\n##### before\ntype: `function`\n\nfunction to call before each test. good for pre-conditions.\n\n##### after\ntype: `function`\n\nfunction to call after each test. good for cleanup.\n\n### tentamen.suite(title, fn?)\nstart a new group of tests.\n\n#### title\ntype: `string`\n\nthe suite title.\n\n#### fn\ntype: `function`\n\na new function to replace the current value of `this.fn` with.\n\n### tentamen.add(title, input, expected)\nrun a new test.\n\n#### title\ntype: `string`\n\nthe test title.\n\n#### input\ntype: `any`\n\nthe input to test with.\\\n[`tentamen.input`](#tentameninput) will be equal to this value.\n\n#### expected\ntype: `any`\n\nthe expected output of the test.\n\n### tentamen.done()\nfinish testing, and output the number of passing tests.\n\n### tentamen.input\nthe input to the test currently being run.\n\n## more information\n\n### on tests and errors\nnormally, if the function being tested throws an error, tentamen will simply fail the test and show it to you \u0026mdash; but what if you want to test *for* an error, to make sure that your code is throwing the right thing at the right time?\n\nin that case, you can add a test whose `expected` value is an error instance:\n```js\ntentamen.suite('error');\n// arrays don't have a startsWith method!\ntentamen.add('should fail', [], new TypeError);\n```\n```\nerror\n  o  should fail\n     (TypeError)\n```\n\nthis works with custom error classes, too.\n\n### license\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsporeball%2Ftentamen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsporeball%2Ftentamen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsporeball%2Ftentamen/lists"}