Skip to content

Commit

Permalink
Make test cover child resources too.
Browse files Browse the repository at this point in the history
  • Loading branch information
tjprescott committed Mar 7, 2024
1 parent cbdc1ff commit 43af0a9
Showing 1 changed file with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,30 @@ it("Emits a warning for an ARM resource that doesn't specify `@pattern` on the n
namespace Microsoft.Contoso;
model Employee is ProxyResource<{}> {
@doc("Name of employee")
@key("employeeName")
@path
@segment("employees")
name: string;
}
@parentResource(Employee)
model EmployeeRole is ProxyResource<{}> {
@key("roleName")
@segment("roles")
@path
@visibility("read")
name: string;
}
`
)
.toEmitDiagnostics({
code: "@azure-tools/typespec-azure-resource-manager/arm-resource-name-pattern",
});
.toEmitDiagnostics([
{
code: "@azure-tools/typespec-azure-resource-manager/arm-resource-name-pattern",
},
{
code: "@azure-tools/typespec-azure-resource-manager/arm-resource-name-pattern",
},
]);
});

it("Does not emit a warning for an ARM resource that specifies `@pattern` on the name", async () => {
Expand All @@ -56,6 +69,16 @@ it("Does not emit a warning for an ARM resource that specifies `@pattern` on the
@path
@segment("employees")
name: string;
}
@parentResource(Employee)
model EmployeeRole is ProxyResource<{}> {
@key("roleName")
@segment("roles")
@pattern("^[a-zA-Z0-9-]{3,24}$")
@path
@visibility("read")
name: string;
}`
)
.toBeValid();
Expand Down

0 comments on commit 43af0a9

Please sign in to comment.