Add a cunstom-inflector to handle pluralizing entry

This commit is contained in:
Leonard Smith 2020-10-07 13:41:57 -05:00
parent df78624d04
commit f21731b771
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,13 @@
import Inflector from 'ember-inflector';
export function initialize(/* application */) {
const inflector = Inflector.inflector;
// Tell the inflector that the plural of "entry" is "entries"
inflector.irregular('entry', 'entries');
}
export default {
name: 'custom-inflector-rules',
initialize
};

View File

@ -0,0 +1,29 @@
import Application from '@ember/application';
import { initialize } from 'gwt-frontend/initializers/custom-inflector-rules';
import { module, test } from 'qunit';
import Resolver from 'ember-resolver';
import { run } from '@ember/runloop';
module('Unit | Initializer | custom-inflector-rules', function(hooks) {
hooks.beforeEach(function() {
this.TestApplication = class TestApplication extends Application {}
this.TestApplication.initializer({
name: 'initializer under test',
initialize
});
this.application = this.TestApplication.create({ autoboot: false, Resolver });
});
hooks.afterEach(function() {
run(this.application, 'destroy');
});
// TODO: Replace this with your real tests.
test('it works', async function(assert) {
await this.application.boot();
assert.ok(true);
});
});