Skip to content

Commit

Permalink
Uprade cadl ranch version to v0.16.1 (#2907)
Browse files Browse the repository at this point in the history
* uprade cadl ranch version to v0.16.1

* disable rlc versioning removed test case

* update test case

* remove try catch in test case
  • Loading branch information
v-jiaodi authored Nov 15, 2024
1 parent c216584 commit 78d167e
Show file tree
Hide file tree
Showing 94 changed files with 5,195 additions and 8,902 deletions.
122 changes: 27 additions & 95 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/typespec-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
"license": "MIT",
"devDependencies": {
"@azure-rest/core-client": "^2.3.1",
"@azure-tools/cadl-ranch-expect": "^0.15.5",
"@azure-tools/cadl-ranch-specs": "^0.38.0",
"@azure-tools/cadl-ranch": "^0.15.0",
"@azure-tools/cadl-ranch-expect": "^0.15.6",
"@azure-tools/cadl-ranch-specs": "^0.39.2",
"@azure-tools/cadl-ranch": "^0.16.1",
"@azure-tools/cadl-ranch-api": "^0.5.0",
"@azure-tools/typespec-autorest": ">=0.48.0 <1.0.0",
"@azure-tools/typespec-azure-core": ">=0.48.0 <1.0.0",
Expand Down
9 changes: 5 additions & 4 deletions packages/typespec-ts/test/commands/cadl-ranch-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,11 @@ export const rlcTsps = [
outputPath: "versioning/madeOptional",
inputPath: "versioning/madeOptional"
},
{
outputPath: "versioning/removed",
inputPath: "versioning/removed"
},
// disable it as https://github.com/Azure/autorest.typescript/issues/2902
// {
// outputPath: "versioning/removed",
// inputPath: "versioning/removed"
// },
{
outputPath: "versioning/renamedFrom",
inputPath: "versioning/renamedFrom"
Expand Down
40 changes: 16 additions & 24 deletions packages/typespec-ts/test/integration/arrayItemTypes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,34 +79,26 @@ describe("Array Item-Types Client", () => {

matrix([testedTypes], async (params: TypeDetail) => {
it(`should get a ${params.type} value`, async () => {
try {
const result = await client
.path(`/type/array/${params.type}` as any)
.get();
assert.strictEqual(result.status, "200");
assert.deepEqual(result.body, params.defaultValue);
} catch (err) {
assert.fail(err as string);
}
const result = await client
.path(`/type/array/${params.type}` as any)
.get();
assert.strictEqual(result.status, "200");
assert.deepEqual(result.body, params.defaultValue);
});

it(`should put a ${params.type} value`, async () => {
try {
let property;
if (params.convertedToFn) {
property = params.convertedToFn(params.defaultValue);
} else {
property = params.defaultValue;
}
const result = await client
.path(`/type/array/${params.type}` as any)
.put({
body: property
});
assert.strictEqual(result.status, "204");
} catch (err) {
assert.fail(err as string);
let property;
if (params.convertedToFn) {
property = params.convertedToFn(params.defaultValue);
} else {
property = params.defaultValue;
}
const result = await client
.path(`/type/array/${params.type}` as any)
.put({
body: property
});
assert.strictEqual(result.status, "204");
});
});
});
31 changes: 15 additions & 16 deletions packages/typespec-ts/test/integration/authApiKey.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,34 @@ import ApiKeyClientFactory, {
} from "./generated/authentication/api-key/src/index.js";
import { assert } from "chai";
describe("AuthApiKeyClient Rest Client", () => {
let client: AuthApiKeyClient;
let validKeyClient: AuthApiKeyClient;
let invalidKeyClient: AuthApiKeyClient;

beforeEach(() => {
client = ApiKeyClientFactory(
validKeyClient = ApiKeyClientFactory(
{
key: "valid-key"
},
{ allowInsecureConnection: true }
);
invalidKeyClient = ApiKeyClientFactory(
{
key: "invalid-key"
},
{ allowInsecureConnection: true }
);
});

it("should return 204 when the apiKey is valid", async () => {
try {
const result = await client.path("/authentication/api-key/valid").get();
assert.strictEqual(result.status, "204");
} catch (err) {
assert.fail(err as string);
}
const result = await validKeyClient.path("/authentication/api-key/valid").get();
assert.strictEqual(result.status, "204");
});

it("should return 403 when the apiKey is invalid", async () => {
try {
const result = await client.path("/authentication/api-key/invalid").get();
assert.strictEqual(result.status, "403");
if (result.status === "403") {
assert.strictEqual(result.body.error, "invalid-api-key");
}
} catch (err) {
assert.fail(err as string);
const result = await invalidKeyClient.path("/authentication/api-key/invalid").get();
assert.strictEqual(result.status, "403");
if (result.status === "403") {
assert.strictEqual(result.body.error, "invalid-api-key");
}
});
});
Loading

0 comments on commit 78d167e

Please sign in to comment.