{"id":24056872,"url":"https://github.com/eyal-wowhub/unittest","last_synced_at":"2025-06-28T18:05:01.841Z","repository":{"id":270761226,"uuid":"911381103","full_name":"Eyal-WowHub/UnitTest","owner":"Eyal-WowHub","description":"A library that offers an easy, efficient, and organized way to create, manage, and run unit tests.","archived":false,"fork":false,"pushed_at":"2025-02-09T15:10:28.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-26T12:16:18.001Z","etag":null,"topics":["lib","library","lua","world-of-warcraft","world-of-warcraft-addon","wow","wow-addon"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Eyal-WowHub.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":"2025-01-02T22:06:44.000Z","updated_at":"2025-02-09T15:10:32.000Z","dependencies_parsed_at":"2025-01-05T14:34:12.861Z","dependency_job_id":null,"html_url":"https://github.com/Eyal-WowHub/UnitTest","commit_stats":null,"previous_names":["eyal-wow-addons/unittest","eyal-wowhub/unittest"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eyal-WowHub%2FUnitTest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eyal-WowHub%2FUnitTest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eyal-WowHub%2FUnitTest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eyal-WowHub%2FUnitTest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Eyal-WowHub","download_url":"https://codeload.github.com/Eyal-WowHub/UnitTest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240849013,"owners_count":19867617,"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":["lib","library","lua","world-of-warcraft","world-of-warcraft-addon","wow","wow-addon"],"created_at":"2025-01-09T05:27:24.707Z","updated_at":"2025-02-26T12:16:21.609Z","avatar_url":"https://github.com/Eyal-WowHub.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UnitTest\n\nA library that offers an easy, efficient, and organized way to create, manage, and run unit tests.\n\nTo run the tests, create a macro and paste the following script: `/run LibStub(\"UnitTest-1.0\"):Run()`.\n\n#### Dependencies: [LibStub](https://www.curseforge.com/wow/addons/libstub), [Contracts](https://github.com/Eyal-WowHub/Contracts)\n\n### Example:\n\n1. Calculator\n```lua\n-- Math.lua\nlocal T = UnitTest_Table(\"Math\", {\n    Add = function(a, b)\n        return a + b\n    end,\n    Divide = function(a, b)\n        assert(b ~= 0, \"Divided by zero. The denominator cannot be zero.\")\n\n        return a / b\n     end\n}, ...)\n\ndo\n    local Add = T:Test(\"Add\")\n\n    Add[\"Should return 3\"] = function(self, math)\n        self:Assert(math.Add(1, 2) == 3)\n    end\nend\n\ndo\n    local Divide = T:Test(\"Divide\")\n\n    Divide[\"Should throw when divided by zero\"] = function(self, math)\n        self:Capture(function()\n            math.Divide(1, 1)\n        end)\n    end\nend\n```\n2. UnitTest\n```lua\n-- Modules.lua\nlocal T = UnitTest_Library(\"UnitTest-1.0\", ...)\n\ndo\n    local Modules = T:Test(\"Modules\")\n\n    Modules[\"Create a module\"] = function(self, ref)\n        self:Assert(Modules ~= nil)\n    end\nend\n```\n\n### Outputs:\n\n```\n-----------------------------------------------------------------------------------------------\n+ Calculator (Modules: 1)\n-----------------------------------------------------------------------------------------------\n    + Math (Scopes: 2)\n        + Add (Tests: 1)\n            + Should return 3\n        + Divide (Tests: 1)\n            + Should throw when divided by zero\n    \u003cTest Failure\u003e The function should have thrown an error, but it did not.\n    at 'Interface/AddOns/Calculator/Tests/MathTests.lua:24' \n    in 'Interface/AddOns/Calculator/Tests/MathTests.lua:23'.\n-----------------------------------------------------------------------------------------------\n+ UnitTest (Modules: 1)\n-----------------------------------------------------------------------------------------------\n    + UnitTest-1.0 (Scopes: 1)\n       + Modules (Tests: 1)\n          + Create a module\n-----------------------------------------------------------------------------------------------\nTests: 3 | Addons: 2 | Modules: 2 | Scopes: 3 | Passed: 2 | Failed: 1\n-----------------------------------------------------------------------------------------------\n```\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feyal-wowhub%2Funittest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feyal-wowhub%2Funittest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feyal-wowhub%2Funittest/lists"}