Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Expand Up @@ -33,4 +33,10 @@ describe("Azure ClientGeneratorCore Override Client", () => {
param2: "param2"
});
});

it("should group parameters correctly", async () => {
Comment thread
JialinHuang803 marked this conversation as resolved.
Outdated
// Test parameter grouping with @override decorator
// Verifies that parameters are grouped correctly into GroupParametersOptions
await client.groupParameters.group("param1", "param2");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ describe("PageableClient Classical Client", () => {
assert.deepStrictEqual<Pet[]>(items, pets);
});

describe("AlternateInitialVerb", () => {
it("should list pets using post initial verb", async () => {
const iter = client.serverDrivenPagination.alternateInitialVerb.post({
filter: "foo eq bar"
});
const items: Array<Pet> = [];
for await (const pet of iter) {
items.push(pet);
}
assert.strictEqual(items.length, 4);
assert.deepStrictEqual<Pet[]>(items, pets);
});
});

describe("XmlPagination", () => {
it("should list xml pagination with next link", async () => {
const iter = client.xmlPagination.listWithNextLink();
Expand Down
141 changes: 141 additions & 0 deletions packages/typespec-ts/test/azureModularIntegration/payloadXml.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,145 @@ describe("Payload XML Client", () => {
}
});
});

describe("ModelWithRenamedProperty", () => {
const expected = { title: "foo", author: "bar" };

it("should get model with renamed property", async () => {
const result = await client.modelWithRenamedPropertyValue.get();
assert.deepEqual(result, expected);
});

it("should put model with renamed property", async () => {
await client.modelWithRenamedPropertyValue.put(expected);
});
});

describe("ModelWithNestedModel", () => {
const expected = { nested: { name: "foo", age: 123 } };

it("should get model with nested model", async () => {
const result = await client.modelWithNestedModelValue.get();
assert.deepEqual(result, expected);
});

it("should put model with nested model", async () => {
await client.modelWithNestedModelValue.put(expected);
});
});

describe("ModelWithRenamedNestedModel", () => {
const expected = { author: { name: "foo" } };

it("should get model with renamed nested model", async () => {
const result = await client.modelWithRenamedNestedModelValue.get();
assert.deepEqual(result, expected);
});

it("should put model with renamed nested model", async () => {
await client.modelWithRenamedNestedModelValue.put(expected);
});
});

describe("ModelWithWrappedPrimitiveCustomItemNames", () => {
const expected = { tags: ["fiction", "classic"] };

it("should get model with wrapped primitive custom item names", async () => {
const result =
await client.modelWithWrappedPrimitiveCustomItemNamesValue.get();
assert.deepEqual(result, expected);
});

it("should put model with wrapped primitive custom item names", async () => {
await client.modelWithWrappedPrimitiveCustomItemNamesValue.put(expected);
});
});

describe("ModelWithUnwrappedModelArray", () => {
const expected = {
items: [
{ name: "foo", age: 123 },
{ name: "bar", age: 456 }
]
};

it("should get model with unwrapped model array", async () => {
const result = await client.modelWithUnwrappedModelArrayValue.get();
assert.deepEqual(result, expected);
});

it("should put model with unwrapped model array", async () => {
await client.modelWithUnwrappedModelArrayValue.put(expected);
});
});

describe("ModelWithRenamedWrappedModelArray", () => {
const expected = {
items: [
{ name: "foo", age: 123 },
{ name: "bar", age: 456 }
]
};

it("should get model with renamed wrapped model array", async () => {
const result = await client.modelWithRenamedWrappedModelArrayValue.get();
assert.deepEqual(result, expected);
});

it("should put model with renamed wrapped model array", async () => {
await client.modelWithRenamedWrappedModelArrayValue.put(expected);
});
});

describe("ModelWithRenamedUnwrappedModelArray", () => {
const expected = {
items: [
{ name: "foo", age: 123 },
{ name: "bar", age: 456 }
]
};

it("should get model with renamed unwrapped model array", async () => {
const result =
await client.modelWithRenamedUnwrappedModelArrayValue.get();
assert.deepEqual(result, expected);
});

it("should put model with renamed unwrapped model array", async () => {
await client.modelWithRenamedUnwrappedModelArrayValue.put(expected);
});
});

describe("ModelWithRenamedWrappedAndItemModelArray", () => {
const expected = {
books: [{ title: "The Great Gatsby" }, { title: "Les Miserables" }]
};

it("should get model with renamed wrapped and item model array", async () => {
const result =
await client.modelWithRenamedWrappedAndItemModelArrayValue.get();
assert.deepEqual(result, expected);
});

it("should put model with renamed wrapped and item model array", async () => {
await client.modelWithRenamedWrappedAndItemModelArrayValue.put(expected);
});
});

describe("ModelWithRenamedAttribute", () => {
const expected = {
id: 123,
title: "The Great Gatsby",
author: "F. Scott Fitzgerald"
};

it("should get model with renamed attribute", async () => {
const result = await client.modelWithRenamedAttributeValue.get();
assert.deepEqual(result, expected);
});

it("should put model with renamed attribute", async () => {
await client.modelWithRenamedAttributeValue.put(expected);
});
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, beforeEach } from "vitest";
import { assert, describe, it, beforeEach } from "vitest";

import { SpecialWordsClient } from "./generated/special-words/src/index.js";

Expand Down Expand Up @@ -402,4 +402,12 @@ describe("Special Words Client", () => {
name: "ok"
});
});

describe("ExtensibleStrings", () => {
it("should put extensible string value", async () => {
const result =
await client.extensibleStrings.putExtensibleStringValue("class");
assert.strictEqual(result.body, "class");
});
});
});
Loading