Skip to content

Commit

Permalink
chore: rename backbone attrubte tag
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbi08 committed Dec 3, 2024
1 parent c30dd02 commit 2f7d21b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import { IdentityAttributeQueryTranslator, RelationshipAttributeQueryTranslator,

export class AttributesController extends ConsumptionBaseController {
private attributes: SynchronizedCollection;
private tagsClient: AttributeTagClient;
private attributeTagClient: AttributeTagClient;

public constructor(
parent: ConsumptionController,
Expand All @@ -61,7 +61,7 @@ export class AttributesController extends ConsumptionBaseController {
await super.init();

this.attributes = await this.parent.accountController.getSynchronizedCollection("Attributes");
this.tagsClient = new AttributeTagClient(this.parent.transport.config, this.parent.accountController.authenticator, this.parent.transport.correlator);
this.attributeTagClient = new AttributeTagClient(this.parent.transport.config, this.parent.accountController.authenticator, this.parent.transport.correlator);

return this;
}
Expand Down Expand Up @@ -1295,7 +1295,7 @@ export class AttributesController extends ConsumptionBaseController {
}

public async getAttributeTagCollection(): Promise<AttributeTagCollection> {
const backboneTagList = (await this.tagsClient.getBackboneAttributeTagCollection()).value;
const backboneTagList = (await this.attributeTagClient.getBackboneAttributeTagCollection()).value;
return AttributeTagCollection.fromAny(backboneTagList);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IDatabaseConnection } from "@js-soft/docdb-access-abstractions";
import { AccountController, ClientResult, TagClient, Transport } from "@nmshd/transport";
import { AccountController, AttributeTagClient, ClientResult, Transport } from "@nmshd/transport";
import { spy, when } from "ts-mockito";
import { ConsumptionController } from "../../../src";
import { TestUtil } from "../../core/TestUtil";
Expand All @@ -12,7 +12,7 @@ describe("AttributeTagCollection", function () {
let consumptionController: ConsumptionController;
let accountController: AccountController;

let mockedClient: TagClient;
let mockedClient: AttributeTagClient;

/* eslint-disable @typescript-eslint/naming-convention */
const mockTags = {
Expand Down Expand Up @@ -59,7 +59,7 @@ describe("AttributeTagCollection", function () {
const accounts = await TestUtil.provideAccounts(transport, 1);
({ consumptionController, accountController } = accounts[0]);

const client = consumptionController.attributes["tagsClient"];
const client = consumptionController.attributes["attributeTagClient"];
mockedClient = spy(client);
});

Expand All @@ -70,7 +70,7 @@ describe("AttributeTagCollection", function () {
});

test("should receive the legal tags from the Backbone", async function () {
when(mockedClient.getTags()).thenResolve(ClientResult.ok(mockTags));
when(mockedClient.getBackboneAttributeTagCollection()).thenResolve(ClientResult.ok(mockTags));
const tags = await consumptionController.attributes.getAttributeTagCollection();

expect(tags.toJSON()).toStrictEqualExcluding(mockTags, "@type");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { ClientResult, DefinedTagClient } from "@nmshd/transport";
import { AttributeTagClient, ClientResult } from "@nmshd/transport";
import { reset, spy, when } from "ts-mockito";
import { RuntimeServiceProvider, TestRuntimeServices } from "../lib";

const serviceProvider = new RuntimeServiceProvider();
let runtimeService: TestRuntimeServices;

let mockedRestClient: DefinedTagClient;
let mockedRestClient: AttributeTagClient;

beforeAll(async () => {
runtimeService = (await serviceProvider.launch(1))[0];
const client = runtimeService.consumption.attributes["getAttributeTagCollectionUseCase"]["attributesController"]["tagsClient"] as DefinedTagClient;
const client = runtimeService.consumption.attributes["getAttributeTagCollectionUseCase"]["attributesController"]["attributeTagClient"] as AttributeTagClient;
mockedRestClient = spy(client);
}, 30000);

Expand Down Expand Up @@ -57,7 +57,7 @@ describe("get attributeTagCollection", function () {
/* eslint-enable @typescript-eslint/naming-convention */

test("should receive the legal tags from the Backbone", async function () {
when(mockedRestClient.getBackboneDefinedTags()).thenResolve(ClientResult.ok(mockTags));
when(mockedRestClient.getBackboneAttributeTagCollection()).thenResolve(ClientResult.ok(mockTags));
const tags = await runtimeService.consumption.attributes.getAttributeTagCollection();

expect(tags.value).toStrictEqual(mockTags);
Expand Down

0 comments on commit 2f7d21b

Please sign in to comment.