Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { TestHost } from "@typespec/compiler/testing";
import { strictEqual } from "assert";
import { beforeEach, describe, it } from "vitest";
import { createModel } from "../../src/lib/client-model-builder.js";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if you meant to publish this PR, but a lot of these imported packages don't exist in this repo.

import {
createEmitterContext,
createEmitterTestHost,
createNetSdkContext,
typeSpecCompile,
} from "./utils/test-util.js";

describe("Test GetInputType for scalar", () => {
let runner: TestHost;

beforeEach(async () => {
runner = await createEmitterTestHost();
});

it("azureLocation scalar", async () => {
const program = await typeSpecCompile(
`
op test(@query location: azureLocation): void;
`,
runner,
{ IsNamespaceNeeded: true, IsAzureCoreNeeded: true },
);
const context = createEmitterContext(program);
const sdkContext = await createNetSdkContext(context);
const root = createModel(sdkContext);
const inputParamArray = root.Clients[0].Operations[0].Parameters.filter(
(p) => p.Name === "location",
);
strictEqual(1, inputParamArray.length);
const type = inputParamArray[0].Type;
strictEqual(type.kind, "string");
strictEqual(type.name, "azureLocation");
strictEqual(type.crossLanguageDefinitionId, "Azure.Core.azureLocation");
strictEqual(type.baseType?.kind, "string");
strictEqual(type.baseType.name, "string");
strictEqual(type.baseType.crossLanguageDefinitionId, "TypeSpec.string");
});
});
Loading