{"id":16316494,"url":"https://github.com/workmanw/ember-qunit-assert-helpers","last_synced_at":"2025-03-16T14:30:54.002Z","repository":{"id":48268768,"uuid":"80175723","full_name":"workmanw/ember-qunit-assert-helpers","owner":"workmanw","description":"An ember-addon that provides additional QUnit 2.0 assertions specific to Ember.js.","archived":false,"fork":false,"pushed_at":"2021-10-17T14:09:33.000Z","size":40,"stargazers_count":13,"open_issues_count":10,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-27T10:35:35.604Z","etag":null,"topics":["ember","ember-addon","qunit"],"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/workmanw.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-27T02:35:00.000Z","updated_at":"2024-05-30T03:07:39.000Z","dependencies_parsed_at":"2022-09-09T06:50:18.073Z","dependency_job_id":null,"html_url":"https://github.com/workmanw/ember-qunit-assert-helpers","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workmanw%2Fember-qunit-assert-helpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workmanw%2Fember-qunit-assert-helpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workmanw%2Fember-qunit-assert-helpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workmanw%2Fember-qunit-assert-helpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/workmanw","download_url":"https://codeload.github.com/workmanw/ember-qunit-assert-helpers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243818195,"owners_count":20352629,"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":["ember","ember-addon","qunit"],"created_at":"2024-10-10T22:04:48.881Z","updated_at":"2025-03-16T14:30:53.677Z","avatar_url":"https://github.com/workmanw.png","language":"JavaScript","readme":"# ember-qunit-assert-helpers\n\nThis addon provides additional QUnit 2.0 assertions that are specific to Ember.js. It is meant to be a replacement for [ember-dev](https://github.com/emberjs/ember-dev) which only supports QUnit 1.0.\n\nCan be use in your application or an addon.\n\n## Installation\n\n```\nember install ember-qunit-assert-helpers\n```\n\n## Compatibility\n\nThis addon relies on functionality introduced in Ember 2.1. If you need support for Ember 2.0 and old, please also include [ember-debug-handlers-polyfill](https://github.com/rwjblue/ember-debug-handlers-polyfill).\n\n## Usage\n\n### `Ember.assert` Assertions\n\n`assert.expectAssertion(callback, matcher)`\n\nAsserts that `Ember.assert` did throw an error. An optional string or regular expression matcher can be provided to match a specific error message.\n\n```javascript\ntest('triggers Ember.assert', function(assert) {\n  assert.expectAssertion(() =\u003e {\n    // Code triggers Ember.assert\n  });\n\n  assert.expectAssertion(() =\u003e {\n    Ember.assert('You forgot \"bar\", the required parameter');\n  }, /You forgot \"\\w+\", the required parameter/);\n})\n```\n\n\n### `Ember.run` Assertions\n\n`assert.expectNoRunLoop()`\n\nAsserts that there is not a current run loop running and there are no scheduled timers. If there are, they will be cleaned up.\n\n```javascript\ntest('`Ember.deprecate` was called anytime during the test and matched', function(assert) {\n  Ember.run.later(() =\u003e { });\n  assert.expectNoRunLoop(); // Fail\n});\n```\n\n\n### `Ember.deprecate` Assertions\n\n`assert.expectDeprecation(callback, matcher)`\n\nAsserts that `Ember.deprecate` was called. An optional callback can be provided. An optional string or regular expression matcher can also be provided.\n\n```javascript\ntest('`Ember.deprecate` was called anytime during the test', function(assert) {\n  // ...\n\n  // One or more deprecations were triggered since the start of this test\n  assert.expectDeprecation();\n});\n\ntest('`Ember.deprecate` was called in a callback', function(assert) {\n  assert.expectDeprecation(() =\u003e {\n    // Code triggers one or more Ember.deprecate\n  });\n});\n\ntest('`Ember.deprecate` was called anytime during the test and matched', function(assert) {\n  // ...\n\n  // One or more deprecations matching a specific message were triggered since the start of this test\n  assert.expectDeprecation(/expected deprecation message/);\n});\n\ntest('`Ember.deprecate` was called in a callback', function(assert) {\n  assert.expectDeprecation(() =\u003e {\n    Ember.deprecate('API is deprecated', false, {\n      id: 'old-api',\n      until: '3.0.0'\n    })\n  }, 'API is deprecated');\n});\n```\n\n`assert.expectNoDeprecation(callback, matcher)`\n\nAsserts that `Ember.deprecate` was not called. An optional callback can be provided. An optional matcher can also be provided.\n\n```javascript\ntest('`Ember.deprecate` was not called anytime during the test', function(assert) {\n  // ...\n\n  // No deprecations were triggered since the start of this test\n  assert.expectNoDeprecation();\n});\n```\n\n### `Ember.warn` Assertions\n\n*Same as `Ember.deprecate`, but for warnings. Above code samples can be applied here.*\n\n`assert.expectWarning(callback, matcher)`\n\nAsserts that `Ember.warn` was called. An optional callback can be provided. An optional matcher can also be provided.\n\n`assert.expectNoWarning(callback, matcher)`\n\nAsserts that `Ember.warn` was not called. An optional callback can be provided. An optional matcher can also be provided.\n\n\n### `afterEach` asserting\n\nYou can easily use these asserts in your `afterEach`.\n\n```javascript\nmoduleForComponent('x-foo', {\n  integration: true,\n  afterEach(assert) {\n    assert.expectNoDeprecation();\n    assert.expectNoRunLoop();\n    assert.expectNoWarning();\n  }\n});\n```\n\n\n## Thanks and Credit\n\nThanks to Robert Jackson ([@rwjblue](https://github.com/rwjblue)) for providing guidance on the implementation.\n\nCredit goes [ember-dev](https://github.com/emberjs/ember-dev) and [CrowdStrike](https://www.crowdstrike.com/) for the overall concept and much the API provided by this addon.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkmanw%2Fember-qunit-assert-helpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworkmanw%2Fember-qunit-assert-helpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkmanw%2Fember-qunit-assert-helpers/lists"}