Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
ember-cli-custom-assertions
Advanced tools
Readme
Add custom assertions to your Ember test suite.
ember install ember-cli-custom-assertions
If it is a bug please open an issue on GitHub.
Add new assertions to test/assertions
. Then use on the assert
object in your test suite.
For example:
// tests/assertions/contains.js
export default function(context, element, text, message) {
message = message || `${element} should contain "${text}"`;
let actual = context.$(element).text();
let expected = text;
let result = !!actual.match(new RegExp(expected));
this.pushResult({ result, actual, expected, message });
}
// tests/acceptance/foo-test.js
test('foo is bar', function(assert) {
visit('/');
andThen(function() {
assert.contains('.foo', 'Foo Bar');
});
});
Note: hyphenated file names like tests/assertions/double-trouble.js
will be camelized: assert.doubleTrouble
You can generate a new assertion by using the assertion
blueprint:
ember g assertion double-trouble
A context
is always injected as the first argument. You don't need to
pass a context when calling the assertion.
// good
assert.contains('.foo', 'Foo bar');
// bad
assert.contains(app, '.foo', 'Foo bar');
You must inject the assertions to use them in tests.
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import setupCustomAssertions from 'ember-cli-custom-assertions/test-support';
module('default setup', function(hooks) {
setupTest(hooks);
setupCustomAssertions(hooks);
test('can inject custom assertions', function(assert) {
assert.contains('.foo', 'Foo bar');
});
});
// ...
import { assertionInjector, assertionCleanup } from 'ember-cli-custom-assertions/test-support';
module('Acceptance | foo', {
beforeEach: function() {
var application = startApp();
assertionInjector(application);
},
afterEach: function() {
Ember.run(application, 'destroy');
assertionCleanup(application);
}
});
We are very thankful for the many contributors
This library follows Semantic Versioning
Please do! We are always looking to improve this library. Please see our Contribution Guidelines on how to properly submit issues and pull requests.
DockYard, Inc © 2015
FAQs
Easily add custom assertions to your Ember test suite
The npm package ember-cli-custom-assertions receives a total of 1,883 weekly downloads. As such, ember-cli-custom-assertions popularity was classified as popular.
We found that ember-cli-custom-assertions demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.