let isMatch = this.get('compare').wildcard('ID #9237720978', 'ID #**********'); // true
// app/routes/index.js
export default Ember.Object.extend({
wildcard: Ember.inject.service(),
afterModel: function(model) {
this.get('wildcard').setSymbol('*');
let url = model.url;
let expected = 'https://www.google.com/search?client=safari&rls=en&q=**********&ie=UTF-8&oe=UTF-8';
if (this.get('wildcard').match(url, expected)) {
// strings are equal
}
}
});
ember install ember-wildcard
ember-wildcard is an addon for comparing strings that contains arbitrary data, such at IDs or timestamps. This addon is especially useful when writing tests and comparing expected and actual output.
git clone https://github.com/charlesfries/ember-wildcard
cd ember-wildcard
npm install
npm run lint:js
npm run lint:js -- --fix
ember test
– Runs the test suite on the current Ember versionember test --server
– Runs the test suite in "watch mode"npm test
– Runsember try:each
to test your addon against multiple Ember versions
ember serve
- Visit the dummy application at http://localhost:4200.
For more information on using ember-cli, visit https://ember-cli.com/.
This project is licensed under the MIT License.