{"id":23078023,"url":"https://github.com/jaliborc/wowunit","last_synced_at":"2025-08-15T19:33:08.613Z","repository":{"id":141927847,"uuid":"11648983","full_name":"Jaliborc/WoWUnit","owner":"Jaliborc","description":"A unit testing framework for World of Warcraft","archived":false,"fork":false,"pushed_at":"2024-05-01T18:35:32.000Z","size":95,"stargazers_count":30,"open_issues_count":1,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-02T13:10:43.130Z","etag":null,"topics":["addon","game-events","lua","unit-testing","world-of-warcraft"],"latest_commit_sha":null,"homepage":"","language":"Lua","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/Jaliborc.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"patreon":"jaliborc","custom":"paypal.me/jaliborc"}},"created_at":"2013-07-25T01:11:44.000Z","updated_at":"2024-05-01T18:35:36.000Z","dependencies_parsed_at":"2024-02-19T19:13:42.957Z","dependency_job_id":"a510b0c8-3a3a-445a-902d-51c097794923","html_url":"https://github.com/Jaliborc/WoWUnit","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaliborc%2FWoWUnit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaliborc%2FWoWUnit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaliborc%2FWoWUnit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaliborc%2FWoWUnit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jaliborc","download_url":"https://codeload.github.com/Jaliborc/WoWUnit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229948946,"owners_count":18149571,"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":["addon","game-events","lua","unit-testing","world-of-warcraft"],"created_at":"2024-12-16T10:46:11.500Z","updated_at":"2024-12-16T10:46:12.097Z","avatar_url":"https://github.com/Jaliborc.png","language":"Lua","funding_links":["https://patreon.com/jaliborc","paypal.me/jaliborc","https://www.patreon.com/jaliborc"],"categories":[],"sub_categories":[],"readme":"\n![Preview](http://jaliborc.com/media/addons/large/wowunit.jpg)\n\n[![Install](http://img.shields.io/badge/install-curseforge-f16436)](https://www.curseforge.com/wow/addons/pettracker)\n[![Patreon](http://img.shields.io/badge/news-patreon-ff424d)](https://www.patreon.com/jaliborc)\n[![Community](http://img.shields.io/badge/community-discord-5865F2)](https://bit.ly/discord-jaliborc)\n\n# WoWUnit :microscope:\nWoWUnit allows you to easily write unit tests for your World of Warcraft addons and provides an interface to monitor them. Unit tests can be run at game events. Also provides methods for temporarily mocking variables.\n\n## Example\nLet's assume we define the following functions in our addon:\n\n    Numbers = function() return 1, 2, 3 end\n    Realm = function() GetRealmName() .. '!' end\n\nWe can make the following tests:\n\n    local AreEqual, Exists, Replace = WoWUnit.AreEqual, WoWUnit.Exists, WoWUnit.Replace\n    local Tests = WoWUnit('MyAddonName', 'PLAYER_UPDATE', 'MONEY_UPDATE')\n        -- tests will be called at startup, PLAYER_UPDATE and MONEY_UPDATE events\n\n    function Tests:PassingTest()\n        AreEqual({1,2,3}, {Numbers()})\n        Exists(true)\n    end\n\n    function Tests:FaillingTest()\n        AreEqual('Apple', 'Pie')\n        Exists(false)\n    end\n\n    function Tests:MockingTest()\n        Replace('GetRealmName', function() return 'Horseshoe' end)\n        AreEqual('Horseshoe!', Realm())\n    end\n\n## Integration\nThe easiest way to integrate unit testing into your addon is to add `## OptionalDeps: WoWUnit` to your `.toc` file. Then, check for WoWUnit in your code before running tests:\n\n    if WoWUnit then\n        local Tests = WoWUnit('MyTests')\n        ... etc\n    end\n\n## Test API\nA unit test group is created by calling `WoWUnit(name, event1, event2, ...)` or `WoWUnit:NewGroup(name, event1, event2, ...)`.\nUnit tests in the group are called at startup and whenever the game events listed occur.\n\nA unit test is defined by indexing a function in the group. While the test is running, the following methods can be used:\n\n|Name|Description|\n|:--|:--|\n| AreEqual(a, b) | Checks wether `a` and `b` match. Throws a fail status if not. |\n| IsTrue(value) | Checks wether `value` passes an if statement. Throws a fail status if not. |\n| Exists(value) | Same as above. |\n| IsFalse(value) | Checks wether `value` fails an if statement. Throws a fail status if not. |\n| Replace([table,] name, replace) | Temporarly replaces `table[name]` or global `name` with `replace` while the unit test is running. |\n| ClearReplaces() | Resets all replacements done so far. |\n| Enable() | Enables the current unit test (enabled by default). |\n| Disable() | Disables the current unit test. |\n\n## To Devs\nIf you use this tool, please list `wow-unit` as a tool you used in development on the CurseForge dependencies system. It's a big help! 👍\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaliborc%2Fwowunit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaliborc%2Fwowunit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaliborc%2Fwowunit/lists"}