Skip to content

Commit

Permalink
Add codefix test.
Browse files Browse the repository at this point in the history
  • Loading branch information
tjprescott committed Mar 22, 2024
1 parent d38a661 commit 9162849
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,37 @@ it("Emits a warning for an ARM resource that doesn't specify `@pattern` on the n
]);
});

it("Allows codefix when ARM resource name is missing pattern.", async () => {
await tester
.expect(
`
@armProviderNamespace
@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1)
namespace Microsoft.Contoso;
model Employee is ProxyResource<{}> {
@key("employeeName")
@path
@segment("employees")
name: string;
}
`
)
.applyCodeFix("add-pattern-decorator").toEqual(`
@armProviderNamespace
@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1)
namespace Microsoft.Contoso;
model Employee is ProxyResource<{}> {
@pattern(/^[a-zA-Z0-9-]+$/)
@key("employeeName")
@path
@segment("employees")
name: string;
}
`);
});

it("Does not emit a warning for an ARM resource that specifies `@pattern` on the name", async () => {
await tester
.expect(
Expand Down

0 comments on commit 9162849

Please sign in to comment.