From a042e09748f36ec704f17e6afe0e610381cba5b8 Mon Sep 17 00:00:00 2001 From: Jonas Metzener Date: Wed, 3 Jan 2024 11:24:07 +0100 Subject: [PATCH] fix(services): namespace all services BREAKING CHANGE: All services are now namespaced with "alexandria-". If your host app customized the config service, you'll need to remove the name customization in the passed services to the engine. For further information, please take a look at the readme. --- README.md | 34 +++++++++++-------- addon/adapters/application.js | 2 +- addon/components/category-nav/category.js | 2 +- addon/components/document-card.js | 2 +- addon/components/document-delete-button.js | 2 +- addon/components/document-upload-button.js | 2 +- addon/components/document-view.js | 4 +-- addon/components/documents-side-panel.js | 2 +- addon/components/mark-manager.js | 2 +- addon/components/mark-manager/mark.js | 2 +- addon/components/multi-document-details.js | 2 +- addon/components/side-panel-toggle.js | 2 +- addon/components/single-document-details.js | 6 ++-- addon/components/tag-filter.js | 4 +-- addon/components/tag-manager.js | 2 +- addon/controllers/application.js | 2 +- addon/engine.js | 2 +- addon/helpers/resolve-group.js | 2 +- addon/helpers/resolve-user.js | 2 +- addon/models/document.js | 2 +- addon/models/mark.js | 2 +- addon/routes/application.js | 6 ++-- .../{config.js => alexandria-config.js} | 2 +- .../{documents.js => alexandria-documents.js} | 4 +-- .../{marks.js => alexandria-marks.js} | 2 +- ...side-panel.js => alexandria-side-panel.js} | 3 +- .../services/{tags.js => alexandria-tags.js} | 4 +-- tests/dummy/app/app.js | 7 +--- tests/dummy/app/services/alexandria-config.js | 11 ++++-- .../components/document-card-test.js | 2 +- .../components/document-list-item-test.js | 4 +-- .../components/document-upload-button-test.js | 3 +- .../components/document-view-test.js | 4 +-- .../single-document-details-test.js | 4 +-- ...s-test.js => alexandria-documents-test.js} | 8 ++--- .../{tags-test.js => alexandria-tags-test.js} | 10 +++--- 36 files changed, 82 insertions(+), 74 deletions(-) rename addon/services/{config.js => alexandria-config.js} (92%) rename addon/services/{documents.js => alexandria-documents.js} (97%) rename addon/services/{marks.js => alexandria-marks.js} (95%) rename addon/services/{side-panel.js => alexandria-side-panel.js} (84%) rename addon/services/{tags.js => alexandria-tags.js} (95%) rename tests/unit/services/{documents-test.js => alexandria-documents-test.js} (88%) rename tests/unit/services/{tags-test.js => alexandria-tags-test.js} (86%) diff --git a/README.md b/README.md index e7daf4b3..2bb0e95c 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ constructor(...args) { "session", "intl", "notification", - { config: "alexandria-config" }, + "alexandria-config", ], }, }, @@ -63,8 +63,8 @@ meta value for a model should be. Each configuration field is scoped by model na (check out the example to understand what is meant by this). For this you need to create a service extending from -`ember-alexandria/services/config` which you then have to pass as `config` to -alexandria. +`ember-alexandria/services/alexandria-config` which you then have to pass as +`alexandria-config` to alexandria. This is needed since an engine does not merge its env into the host apps. See https://github.com/ember-engines/ember-engines/issues/176 for more info. @@ -81,9 +81,9 @@ can ignore the getters and just define the field as usual. **Example**: ```js -import ConfigService from "ember-alexandria/services/config"; +import AlexandriaConfigService from "ember-alexandria/services/alexandria-config"; -export default class AlexandriaConfigService extends ConfigService { +export default class CustomAlexandriaConfigService extends AlexandriaConfigService { get modelMetaFilters() { return { document: [ @@ -122,17 +122,22 @@ With it you for example fetch the users and groups of the documents in a batch. **Example**: ```js -import ConfigService from "ember-alexandria/services/config"; +import AlexandriaConfigService from "ember-alexandria/services/alexandria-config"; import { inject as service } from "@ember/service"; -export default class AlexandriaConfigService extends ConfigService { +export default class CustomAlexandriaConfigService extends AlexandriaConfigService { @service store; - + activeUser = 1; activeGroup = 1; - resolveUser(id) { return this.store.peekRecord("user", id); } - resolveGroup(id) { return this.store.peekRecord("group", id); } + resolveUser(id) { + return this.store.peekRecord("user", id); + } + + resolveGroup(id) { + return this.store.peekRecord("group", id); + } documentsPostProcess(documents) { const users = documents.map((d) => d.createdByUser); @@ -141,7 +146,7 @@ export default class AlexandriaConfigService extends ConfigService { this.store.query("user", { filter: { id: users.join(",") } }); this.store.query("group", { filter: { id: groups.join(",") } }); - return documents + return documents; } } ``` @@ -155,6 +160,7 @@ Additionally to tags you can configure marks. Marks are similar to tags, but are The icons for marks are from [FontAwesome](https://fontawesome.com/search?o=r&m=free&s=regular%2Csolid). The object for a mark has the following properties: + - `type`: This is the id of a tag used to identify the mark in the backend. - `icon`: This a string, which references an FontAwesome. - `tooltip`: This is shown when hovering over the mark. @@ -162,9 +168,9 @@ The object for a mark has the following properties: An example configuration with two icons might look like this: ```js -import ConfigService from "ember-alexandria/services/config"; +import AlexandriaConfigService from "ember-alexandria/services/alexandria-config"; -export default class AlexandriaConfigService extends ConfigService { +export default class CustomAlexandriaConfigService extends AlexandriaConfigService { get marks() { return [ { @@ -183,6 +189,7 @@ export default class AlexandriaConfigService extends ConfigService { ``` Configure used icons in `config/icons.js` + ```js module.exports = function () { return { @@ -191,7 +198,6 @@ module.exports = function () { }; ``` - ## Contributing See the [Contributing](CONTRIBUTING.md) guide for details. diff --git a/addon/adapters/application.js b/addon/adapters/application.js index 77e136bd..94403011 100644 --- a/addon/adapters/application.js +++ b/addon/adapters/application.js @@ -2,7 +2,7 @@ import { inject as service } from "@ember/service"; import OIDCJSONAPIAdapter from "ember-simple-auth-oidc/adapters/oidc-json-api-adapter"; export default class ApplicationAdapter extends OIDCJSONAPIAdapter { - @service config; + @service("alexandria-config") config; @service session; get namespace() { diff --git a/addon/components/category-nav/category.js b/addon/components/category-nav/category.js index 91e022eb..f6c685e5 100644 --- a/addon/components/category-nav/category.js +++ b/addon/components/category-nav/category.js @@ -5,7 +5,7 @@ import Component from "@glimmer/component"; import { tracked } from "@glimmer/tracking"; export default class CategoryNavCategoryComponent extends Component { - @service documents; + @service("alexandria-documents") documents; @service router; @tracked collapseChildren = false; diff --git a/addon/components/document-card.js b/addon/components/document-card.js index d0448541..8e08e632 100644 --- a/addon/components/document-card.js +++ b/addon/components/document-card.js @@ -8,7 +8,7 @@ import { ErrorHandler } from "ember-alexandria/helpers/error-handler"; export default class DocumentCardComponent extends Component { @service notification; @service intl; - @service config; + @service("alexandria-config") config; get classes() { const classes = [ diff --git a/addon/components/document-delete-button.js b/addon/components/document-delete-button.js index 9f19af9e..40d75954 100644 --- a/addon/components/document-delete-button.js +++ b/addon/components/document-delete-button.js @@ -9,7 +9,7 @@ import { ErrorHandler } from "ember-alexandria/helpers/error-handler"; export default class DocumentDeleteButtonComponent extends Component { @service notification; @service intl; - @service documents; + @service("alexandria-documents") documents; @service router; @tracked dialogVisible = false; diff --git a/addon/components/document-upload-button.js b/addon/components/document-upload-button.js index 4d2a61b7..0c7dbf96 100644 --- a/addon/components/document-upload-button.js +++ b/addon/components/document-upload-button.js @@ -9,7 +9,7 @@ export default class DocumentUploadButtonComponent extends Component { @service notification; @service intl; @service store; - @service documents; + @service("alexandria-documents") documents; categories = query(this, "category", () => ({ "filter[hasParent]": false, diff --git a/addon/components/document-view.js b/addon/components/document-view.js index 28110d46..af971bf8 100644 --- a/addon/components/document-view.js +++ b/addon/components/document-view.js @@ -11,9 +11,9 @@ export default class DocumentViewComponent extends Component { @service notification; @service store; @service intl; - @service documents; + @service("alexandria-documents") documents; @service router; - @service config; + @service("alexandria-config") config; @tracked isDragOver = false; @tracked dragCounter = 0; diff --git a/addon/components/documents-side-panel.js b/addon/components/documents-side-panel.js index 1177308d..56e3491b 100644 --- a/addon/components/documents-side-panel.js +++ b/addon/components/documents-side-panel.js @@ -1,5 +1,5 @@ import { inject as service } from "@ember/service"; import Component from "@glimmer/component"; export default class DocumentsSidePanelComponent extends Component { - @service sidePanel; + @service("alexandria-side-panel") sidePanel; } diff --git a/addon/components/mark-manager.js b/addon/components/mark-manager.js index 5783e2fe..f829402b 100644 --- a/addon/components/mark-manager.js +++ b/addon/components/mark-manager.js @@ -1,7 +1,7 @@ import { inject as service } from "@ember/service"; import Component from "@glimmer/component"; export default class TagManagerComponent extends Component { - @service marks; + @service("alexandria-marks") marks; get documents() { return this.args.documents.filter((document) => !document.isDeleted); diff --git a/addon/components/mark-manager/mark.js b/addon/components/mark-manager/mark.js index 8d2e7321..5464cc9a 100644 --- a/addon/components/mark-manager/mark.js +++ b/addon/components/mark-manager/mark.js @@ -3,7 +3,7 @@ import { inject as service } from "@ember/service"; import Component from "@glimmer/component"; export default class MarkManagerMarkComponent extends Component { - @service marks; + @service("alexandria-marks") marks; get activeDocumentCount() { return this.args.documents.reduce((acc, doc) => { diff --git a/addon/components/multi-document-details.js b/addon/components/multi-document-details.js index 558a76f9..a0f55eba 100644 --- a/addon/components/multi-document-details.js +++ b/addon/components/multi-document-details.js @@ -1,7 +1,7 @@ import { inject as service } from "@ember/service"; import Component from "@glimmer/component"; export default class MultiDocumentDetailsComponent extends Component { - @service sidePanel; + @service("alexandria-side-panel") sidePanel; get mergedTags() { const tags = []; diff --git a/addon/components/side-panel-toggle.js b/addon/components/side-panel-toggle.js index b2798812..87b5d450 100644 --- a/addon/components/side-panel-toggle.js +++ b/addon/components/side-panel-toggle.js @@ -2,5 +2,5 @@ import { inject as service } from "@ember/service"; import Component from "@glimmer/component"; export default class SidePanelToggleComponent extends Component { - @service sidePanel; + @service("alexandria-side-panel") sidePanel; } diff --git a/addon/components/single-document-details.js b/addon/components/single-document-details.js index 512a794f..d00820a6 100644 --- a/addon/components/single-document-details.js +++ b/addon/components/single-document-details.js @@ -12,9 +12,9 @@ import { ErrorHandler } from "ember-alexandria/helpers/error-handler"; // be inheriting from DocumentCard export default class SingleDocumentDetailsComponent extends DocumentCard { @service router; - @service documents; - @service tags; - @service sidePanel; + @service("alexandria-documents") documents; + @service("alexandria-tags") tags; + @service("alexandria-side-panel") sidePanel; @service intl; @tracked editTitle = false; diff --git a/addon/components/tag-filter.js b/addon/components/tag-filter.js index 45255aa0..707f2d6b 100644 --- a/addon/components/tag-filter.js +++ b/addon/components/tag-filter.js @@ -4,8 +4,8 @@ import Component from "@glimmer/component"; import { trackedFunction } from "ember-resources/util/function"; export default class TagFilterComponent extends Component { @service router; - @service tags; - @service marks; + @service("alexandria-tags") tags; + @service("alexandria-marks") marks; @service store; get parsedSelected() { diff --git a/addon/components/tag-manager.js b/addon/components/tag-manager.js index 27e69f25..1598f16d 100644 --- a/addon/components/tag-manager.js +++ b/addon/components/tag-manager.js @@ -8,7 +8,7 @@ import { trackedFunction } from "ember-resources/util/function"; export default class TagManagerComponent extends Component { @service("tags") tagService; - @service config; + @service("alexandria-config") config; @service store; @tracked tagValue; diff --git a/addon/controllers/application.js b/addon/controllers/application.js index 4a4c9f0f..98713d47 100644 --- a/addon/controllers/application.js +++ b/addon/controllers/application.js @@ -13,7 +13,7 @@ export default class ApplicationController extends Controller { "sort", ]; - @service config; + @service("alexandria-config") config; @tracked category; @tracked tags = []; diff --git a/addon/engine.js b/addon/engine.js index 1c1c30ea..248db2e7 100644 --- a/addon/engine.js +++ b/addon/engine.js @@ -11,7 +11,7 @@ export default class EmberAlexandriaEngine extends Engine { Resolver = Resolver; dependencies = { - services: ["session", "intl", "notification", "config"], + services: ["session", "intl", "notification", "alexandria-config"], }; } diff --git a/addon/helpers/resolve-group.js b/addon/helpers/resolve-group.js index c6719dfb..3705e389 100644 --- a/addon/helpers/resolve-group.js +++ b/addon/helpers/resolve-group.js @@ -2,7 +2,7 @@ import Helper from "@ember/component/helper"; import { inject as service } from "@ember/service"; export default class ResolveGroupHelper extends Helper { - @service config; + @service("alexandria-config") config; compute([id]) { return this.config.resolveGroup(id); diff --git a/addon/helpers/resolve-user.js b/addon/helpers/resolve-user.js index 123d4df9..3df8455b 100644 --- a/addon/helpers/resolve-user.js +++ b/addon/helpers/resolve-user.js @@ -2,7 +2,7 @@ import Helper from "@ember/component/helper"; import { inject as service } from "@ember/service"; export default class ResolveUserHelper extends Helper { - @service config; + @service("alexandria-config") config; compute([id]) { return this.config.resolveUser(id); diff --git a/addon/models/document.js b/addon/models/document.js index 59fb2c70..b353f7c2 100644 --- a/addon/models/document.js +++ b/addon/models/document.js @@ -20,7 +20,7 @@ export default class DocumentModel extends LocalizedModel { @hasMany("mark", { inverse: "documents", async: true }) marks; @hasMany("file", { inverse: "document", async: true }) files; - @service config; + @service("alexandria-config") config; get thumbnail() { const thumbnail = this.files.filter( diff --git a/addon/models/mark.js b/addon/models/mark.js index 7fa9337b..ae1f9f0b 100644 --- a/addon/models/mark.js +++ b/addon/models/mark.js @@ -3,7 +3,7 @@ import { attr, hasMany } from "@ember-data/model"; import { LocalizedModel, localizedAttr } from "ember-localized-model"; export default class MarkModel extends LocalizedModel { - @service config; + @service("alexandria-config") config; @localizedAttr name; @localizedAttr description; diff --git a/addon/routes/application.js b/addon/routes/application.js index ee57de5e..c2b65602 100644 --- a/addon/routes/application.js +++ b/addon/routes/application.js @@ -14,9 +14,9 @@ export default class ApplicationRoute extends Route { activeGroup: PARAM_OPTIONS, }; - @service config; - @service documents; - @service marks; + @service("alexandria-config") config; + @service("alexandria-documents") documents; + @service("alexandria-marks") marks; model() {} diff --git a/addon/services/config.js b/addon/services/alexandria-config.js similarity index 92% rename from addon/services/config.js rename to addon/services/alexandria-config.js index da845b5d..8a86f0c8 100644 --- a/addon/services/config.js +++ b/addon/services/alexandria-config.js @@ -1,7 +1,7 @@ import Service from "@ember/service"; import { tracked } from "@glimmer/tracking"; -export default class ConfigService extends Service { +export default class AlexandriaConfigService extends Service { markIcons = {}; @tracked alexandriaQueryParams = {}; diff --git a/addon/services/documents.js b/addon/services/alexandria-documents.js similarity index 97% rename from addon/services/documents.js rename to addon/services/alexandria-documents.js index 261fbc01..dad60b90 100644 --- a/addon/services/documents.js +++ b/addon/services/alexandria-documents.js @@ -3,9 +3,9 @@ import Service, { inject as service } from "@ember/service"; import { tracked } from "@glimmer/tracking"; import fetch from "fetch"; -export default class DocumentsService extends Service { +export default class AlexandriaDocumentsService extends Service { @service store; - @service config; + @service("alexandria-config") config; @service router; @tracked selectedDocuments = []; @tracked shortcutsDisabled = false; diff --git a/addon/services/marks.js b/addon/services/alexandria-marks.js similarity index 95% rename from addon/services/marks.js rename to addon/services/alexandria-marks.js index 69582bc3..e94a5089 100644 --- a/addon/services/marks.js +++ b/addon/services/alexandria-marks.js @@ -4,7 +4,7 @@ import { findAll } from "ember-data-resources"; import { ErrorHandler } from "ember-alexandria/helpers/error-handler"; -export default class MarksService extends Service { +export default class AlexandriaMarksService extends Service { @service store; marks = findAll(this, "mark"); diff --git a/addon/services/side-panel.js b/addon/services/alexandria-side-panel.js similarity index 84% rename from addon/services/side-panel.js rename to addon/services/alexandria-side-panel.js index bfde1442..ec5ebc46 100644 --- a/addon/services/side-panel.js +++ b/addon/services/alexandria-side-panel.js @@ -1,7 +1,8 @@ import { action } from "@ember/object"; import Service from "@ember/service"; import { tracked } from "@glimmer/tracking"; -export default class SidePanelService extends Service { + +export default class AlexandriaSidePanelService extends Service { @tracked open = true; /** diff --git a/addon/services/tags.js b/addon/services/alexandria-tags.js similarity index 95% rename from addon/services/tags.js rename to addon/services/alexandria-tags.js index 1cafb92c..605514d4 100644 --- a/addon/services/tags.js +++ b/addon/services/alexandria-tags.js @@ -5,9 +5,9 @@ import { tracked } from "@glimmer/tracking"; import { ErrorHandler } from "ember-alexandria/helpers/error-handler"; -export default class TagsService extends Service { +export default class AlexandriaTagsService extends Service { @service store; - @service config; + @service("alexandria-config") config; @tracked categoryCache; diff --git a/tests/dummy/app/app.js b/tests/dummy/app/app.js index 05a20724..f4ea10d2 100644 --- a/tests/dummy/app/app.js +++ b/tests/dummy/app/app.js @@ -12,12 +12,7 @@ export default class App extends Application { engines = { "ember-alexandria": { dependencies: { - services: [ - "session", - "intl", - "notification", - { config: "alexandria-config" }, - ], + services: ["session", "intl", "notification", "alexandria-config"], }, }, }; diff --git a/tests/dummy/app/services/alexandria-config.js b/tests/dummy/app/services/alexandria-config.js index 39521189..2f60c796 100644 --- a/tests/dummy/app/services/alexandria-config.js +++ b/tests/dummy/app/services/alexandria-config.js @@ -1,6 +1,9 @@ -import ConfigService from "ember-alexandria/services/config"; +import { later } from "@ember/runloop"; +import { macroCondition, isTesting } from "@embroider/macros"; -export default class AlexandriaConfigService extends ConfigService { +import AlexandriaConfigService from "ember-alexandria/services/alexandria-config"; + +export default class CustomAlexandriaConfigService extends AlexandriaConfigService { markIcons = { decision: "stamp", }; @@ -28,8 +31,10 @@ export default class AlexandriaConfigService extends ConfigService { } resolveUser(id) { + const timeout = macroCondition(isTesting()) ? 1 : 200; + return new Promise((resolve) => - setTimeout(() => resolve((id || "").toUpperCase()), 200), + later(this, () => resolve((id || "").toUpperCase()), timeout), ); } } diff --git a/tests/integration/components/document-card-test.js b/tests/integration/components/document-card-test.js index b1cb742c..26184895 100644 --- a/tests/integration/components/document-card-test.js +++ b/tests/integration/components/document-card-test.js @@ -16,7 +16,7 @@ module("Integration | Component | document-card", function (hooks) { setupRenderingTest(hooks); hooks.beforeEach(function () { - this.owner.register("service:documents", mockDocumentsService); + this.owner.register("service:alexandria-documents", mockDocumentsService); }); test("it renders document card", async function (assert) { diff --git a/tests/integration/components/document-list-item-test.js b/tests/integration/components/document-list-item-test.js index d1bfaa7f..b6397589 100644 --- a/tests/integration/components/document-list-item-test.js +++ b/tests/integration/components/document-list-item-test.js @@ -12,7 +12,7 @@ module("Integration | Component | document-list-item", function (hooks) { this.document = { title: "some document", modifiedAt: new Date("December 1, 2000 00:00:00"), - createdByUser: "some group", + createdByUser: "some user", marks: [], }; this.isSelected = false; @@ -33,7 +33,7 @@ module("Integration | Component | document-list-item", function (hooks) { test("it renders all the required fields for a document", async function (assert) { assert.dom().includesText("some document"); assert.dom().includesText("12/01/2000"); - assert.dom().includesText("some group"); + assert.dom().includesText("SOME USER"); }); test("it fires the onClickDocument function with the correct parameter", async function (assert) { diff --git a/tests/integration/components/document-upload-button-test.js b/tests/integration/components/document-upload-button-test.js index 72390786..6110268e 100644 --- a/tests/integration/components/document-upload-button-test.js +++ b/tests/integration/components/document-upload-button-test.js @@ -11,7 +11,8 @@ module("Integration | Component | document-upload-button", function (hooks) { hooks.beforeEach(function () { this.uploadFnMock = fake(); - this.owner.lookup("service:documents").upload = this.uploadFnMock; + this.owner.lookup("service:alexandria-documents").upload = + this.uploadFnMock; }); test("upload a file with a predefined category", async function (assert) { diff --git a/tests/integration/components/document-view-test.js b/tests/integration/components/document-view-test.js index 13109bbb..a7ed8292 100644 --- a/tests/integration/components/document-view-test.js +++ b/tests/integration/components/document-view-test.js @@ -15,7 +15,7 @@ module("Integration | Component | document-view", function (hooks) { setupMirage(hooks); hooks.beforeEach(function () { - this.owner.register("service:documents", MockDocumentsService); + this.owner.register("service:alexandria-documents", MockDocumentsService); }); test("it renders the documents when in grid view", async function (assert) { @@ -44,7 +44,7 @@ module("Integration | Component | document-view", function (hooks) { test("select document", async function (assert) { const documents = this.server.createList("document", 3); - const docService = this.owner.lookup("service:documents"); + const docService = this.owner.lookup("service:alexandria-documents"); docService.selectedDocuments = [documents[0]]; diff --git a/tests/integration/components/single-document-details-test.js b/tests/integration/components/single-document-details-test.js index 236725a0..aac74e22 100644 --- a/tests/integration/components/single-document-details-test.js +++ b/tests/integration/components/single-document-details-test.js @@ -22,7 +22,7 @@ module("Integration | Component | single-document-details", function (hooks) { setupMirage(hooks); hooks.beforeEach(function () { - this.owner.register("service:documents", mockDocumentsService); + this.owner.register("service:alexandria-documents", mockDocumentsService); }); test("it renders document information", async function (assert) { @@ -53,7 +53,7 @@ module("Integration | Component | single-document-details", function (hooks) { assert.dom("[data-test-created-at]").hasText("12/11/1998, 12:00 AM"); assert .dom("[data-test-created-by-user]") - .hasText(this.selectedDocument.createdByUser); + .hasText(this.selectedDocument.createdByUser.toUpperCase()); assert .dom("[data-test-created-by-group]") .hasText(this.selectedDocument.createdByGroup); diff --git a/tests/unit/services/documents-test.js b/tests/unit/services/alexandria-documents-test.js similarity index 88% rename from tests/unit/services/documents-test.js rename to tests/unit/services/alexandria-documents-test.js index 3576156e..85dd6006 100644 --- a/tests/unit/services/documents-test.js +++ b/tests/unit/services/alexandria-documents-test.js @@ -2,17 +2,17 @@ import { setupTest } from "dummy/tests/helpers"; import { setupMirage } from "ember-cli-mirage/test-support"; import { module, test } from "qunit"; -module("Unit | Service | documents", function (hooks) { +module("Unit | Service | alexandria-documents", function (hooks) { setupTest(hooks); setupMirage(hooks); test("it exists", function (assert) { - const service = this.owner.lookup("service:documents"); + const service = this.owner.lookup("service:alexandria-documents"); assert.ok(service); }); test("it uploads documents", async function (assert) { - const service = this.owner.lookup("service:documents"); + const service = this.owner.lookup("service:alexandria-documents"); const store = this.owner.lookup("service:store"); const category = await store.findRecord( @@ -51,7 +51,7 @@ module("Unit | Service | documents", function (hooks) { }); test("it replaces documents", async function (assert) { - const service = this.owner.lookup("service:documents"); + const service = this.owner.lookup("service:alexandria-documents"); const store = this.owner.lookup("service:store"); const document = await store.findRecord( diff --git a/tests/unit/services/tags-test.js b/tests/unit/services/alexandria-tags-test.js similarity index 86% rename from tests/unit/services/tags-test.js rename to tests/unit/services/alexandria-tags-test.js index 6ba6d86c..d988cacf 100644 --- a/tests/unit/services/tags-test.js +++ b/tests/unit/services/alexandria-tags-test.js @@ -2,19 +2,19 @@ import { setupTest } from "dummy/tests/helpers"; import { setupMirage } from "ember-cli-mirage/test-support"; import { module, test } from "qunit"; -module("Unit | Service | tags", function (hooks) { +module("Unit | Service | alexandria-tags", function (hooks) { setupTest(hooks); setupMirage(hooks); test("it exists", function (assert) { - const service = this.owner.lookup("service:tags"); + const service = this.owner.lookup("service:alexandria-tags"); assert.ok(service); }); test("it adds existing tags", async function (assert) { const requests = this.server.pretender.handledRequests; - const service = this.owner.lookup("service:tags"); + const service = this.owner.lookup("service:alexandria-tags"); const store = this.owner.lookup("service:store"); const document = await store.createRecord("document").save(); @@ -37,7 +37,7 @@ module("Unit | Service | tags", function (hooks) { test("it adds new tags", async function (assert) { const requests = this.server.pretender.handledRequests; - const service = this.owner.lookup("service:tags"); + const service = this.owner.lookup("service:alexandria-tags"); const store = this.owner.lookup("service:store"); const document = await store.createRecord("document").save(); @@ -61,7 +61,7 @@ module("Unit | Service | tags", function (hooks) { test("it removes tags", async function (assert) { const requests = this.server.pretender.handledRequests; - const service = this.owner.lookup("service:tags"); + const service = this.owner.lookup("service:alexandria-tags"); const store = this.owner.lookup("service:store"); const document = await store.createRecord("document").save();