Added index
This commit is contained in:
parent
72f59d6ced
commit
9740deb496
11 changed files with 123 additions and 3 deletions
5
app/adapters/application.js
Normal file
5
app/adapters/application.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import RESTAdapter from '@ember-data/adapter/rest';
|
||||
|
||||
export default class ApplicationAdapter extends RESTAdapter {
|
||||
host = 'http://127.0.0.1:7700';
|
||||
}
|
||||
11
app/initializers/custom-inflector-rules.js
Normal file
11
app/initializers/custom-inflector-rules.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import Inflector from 'ember-inflector';
|
||||
|
||||
export function initialize(/* application */) {
|
||||
const inflector = Inflector.inflector;
|
||||
|
||||
inflector.irregular('index', 'indexes');
|
||||
}
|
||||
|
||||
export default {
|
||||
initialize
|
||||
};
|
||||
7
app/models/index.js
Normal file
7
app/models/index.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import Model, { attr } from '@ember-data/model';
|
||||
|
||||
export default class IndexModel extends Model {
|
||||
@attr('string') primaryKey;
|
||||
@attr('date') createdAt;
|
||||
@attr('date') updatedAt;
|
||||
}
|
||||
7
app/routes/application.js
Normal file
7
app/routes/application.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class ApplicationRoute extends Route {
|
||||
model() {
|
||||
return this.store.findAll('index');
|
||||
}
|
||||
}
|
||||
5
app/serializers/application.js
Normal file
5
app/serializers/application.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import JSONSerializer from '@ember-data/serializer/json';
|
||||
|
||||
export default class ApplicationSerializer extends JSONSerializer {
|
||||
primaryKey = 'uid';
|
||||
}
|
||||
|
|
@ -1,6 +1,3 @@
|
|||
{{page-title "MeiliSearch Admin"}}
|
||||
|
||||
{{outlet}}
|
||||
<div class="container mx-auto">
|
||||
<h1 class="font-mono text-blue-500">Hello Tailwind</h1>
|
||||
</div>
|
||||
|
|
|
|||
12
tests/unit/adapters/application-test.js
Normal file
12
tests/unit/adapters/application-test.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Adapter | application', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let adapter = this.owner.lookup('adapter:application');
|
||||
assert.ok(adapter);
|
||||
});
|
||||
});
|
||||
29
tests/unit/initializers/custom-inflector-rules-test.js
Normal file
29
tests/unit/initializers/custom-inflector-rules-test.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import Application from '@ember/application';
|
||||
|
||||
import { initialize } from 'meilisearch-admin/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);
|
||||
});
|
||||
});
|
||||
13
tests/unit/models/index-test.js
Normal file
13
tests/unit/models/index-test.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Model | index', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let model = store.createRecord('index', {});
|
||||
assert.ok(model);
|
||||
});
|
||||
});
|
||||
11
tests/unit/routes/application-test.js
Normal file
11
tests/unit/routes/application-test.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Route | application', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.owner.lookup('route:application');
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
23
tests/unit/serializers/application-test.js
Normal file
23
tests/unit/serializers/application-test.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Serializer | application', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let serializer = store.serializerFor('application');
|
||||
|
||||
assert.ok(serializer);
|
||||
});
|
||||
|
||||
test('it serializes records', function(assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let record = store.createRecord('application', {});
|
||||
|
||||
let serializedRecord = record.serialize();
|
||||
|
||||
assert.ok(serializedRecord);
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue