Skip to content

Commit

Permalink
Fix URL for getBulkLinks (#1058)
Browse files Browse the repository at this point in the history
  • Loading branch information
nihalbhatnagar authored Dec 12, 2024
1 parent cf9dcbe commit eb27b54
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/modern-forks-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@osdk/client": patch
---

Fix URL for experimental method
2 changes: 1 addition & 1 deletion packages/client/src/__unstable/ConjureSupport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class MetadataClient {

constructor(client: MinimalClient) {
this.#client = client;
this.#ctx = makeConjureContext(client, "/ontology-metadata/api");
this.#ctx = makeConjureContext(client, "ontology-metadata/api");
this.#client.ontologyProvider.getObjectDefinition;

this.#logger = this.#client.logger?.child({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function createBulkLinksAsyncIterFactory(ctx: MinimalClient) {
const bulkLinksIter = pageRequestAsAsyncIter(
getBulkLinksPage.bind(
undefined,
makeConjureContext(ctx, "/object-set-service/api"),
makeConjureContext(ctx, "object-set-service/api"),
),
getResults,
applyPageToken,
Expand Down
22 changes: 21 additions & 1 deletion packages/client/src/createClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
* limitations under the License.
*/

import { __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks } from "@osdk/api/unstable";
import { Task } from "@osdk/client.test.ontology";
import * as SharedClientContext from "@osdk/shared.client.impl";
import { mockFetchResponse, MockOntology } from "@osdk/shared.test";
import type { MockedFunction } from "vitest";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { metadataCacheClient } from "./__unstable/ConjureSupport.js";
import type { Client } from "./Client.js";
import { createClient } from "./createClient.js";
import * as MakeConjureContext from "./ontology/makeConjureContext.js";
import { USER_AGENT } from "./util/UserAgent.js";

describe(createClient, () => {
Expand Down Expand Up @@ -72,7 +75,7 @@ describe(createClient, () => {
describe("check url formatting", () => {
it("urls are correctly formatted", async () => {
const spy = vi.spyOn(SharedClientContext, "createSharedClientContext");
createClient(
const client = createClient(
"https://mock.com",
MockOntology.metadata.ontologyRid,
async () => "Token",
Expand Down Expand Up @@ -107,6 +110,23 @@ describe(createClient, () => {
fetchFunction,
);
expect(spy.mock.calls[3][0]).toBe("https://mock3.com/stuff/first/foo/");

const conjureContextSpy = vi.spyOn(
MakeConjureContext,
"makeConjureContext",
);

metadataCacheClient(
{
baseUrl: "https://mock4.com/",
ontologyProvider: { getObjectDefinition: async () => ({}) },
} as any,
);

expect(
conjureContextSpy.mock.results[0].value["baseUrl"]
+ conjureContextSpy.mock.results[0].value["servicePath"],
).toBe("https://mock4.com/ontology-metadata/api");
});
});
});

0 comments on commit eb27b54

Please sign in to comment.