-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[test][identity] replace assert.ok with more specific assertions #36394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[test][identity] replace assert.ok with more specific assertions #36394
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates test assertions across the Azure Identity SDK test suite to use more specific and semantically appropriate assertion methods from the testing framework. The changes improve test readability and precision by replacing generic assert.ok() calls with more descriptive alternatives like assert.isDefined() and assert.isTrue().
Key Changes
- Replaces
assert.ok(value)withassert.isDefined(value)for existence checks on tokens, errors, and accounts - Replaces
assert.ok(condition)withassert.isTrue(condition)for boolean expression validations (timestamp comparisons, string matches) - Applies these improvements consistently across all credential test files in the identity, identity-vscode, and identity-cache-persistence packages
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/identity/identity/test/public/node/workloadIdentityCredential.spec.ts | Updates token validation assertions for WorkloadIdentityCredential, ManagedIdentityCredential, and DefaultAzureCredential tests |
| sdk/identity/identity/test/public/node/usernamePasswordCredential.spec.ts | Updates token and error message validation assertions |
| sdk/identity/identity/test/public/node/environmentCredential.spec.ts | Updates assertions for client secret, certificate, and username/password authentication tests |
| sdk/identity/identity/test/public/node/deviceCodeCredential.spec.ts | Updates token and account validation assertions, including abort error message checks |
| sdk/identity/identity/test/public/node/clientSecretCredential.spec.ts | Updates assertions for authentication and CAE-enabled token tests |
| sdk/identity/identity/test/public/node/clientCertificateCredential.spec.ts | Updates token validation and error message assertions |
| sdk/identity/identity/test/public/node/azurePipelinesCredential.spec.ts | Updates token and timestamp validation assertions |
| sdk/identity/identity/test/public/node/authorityValidation.spec.ts | Updates token validation assertions for authority validation tests |
| sdk/identity/identity/test/internal/node/workloadIdentityCredential.spec.ts | Updates validation helper function and credential test assertions |
| sdk/identity/identity/test/internal/node/usernamePasswordCredential.spec.ts | Updates token validation for authenticated account logging test |
| sdk/identity/identity/test/internal/node/clientSecretCredential.spec.ts | Updates token validation for authenticated account logging test |
| sdk/identity/identity/test/internal/node/clientCertificateCredential.spec.ts | Updates error existence assertions for certificate validation tests |
| sdk/identity/identity/test/internal/node/caeARM.spec.ts | Updates token validation assertions for CAE challenge flow tests |
| sdk/identity/identity/test/internal/node/azurePowerShellCredential.spec.ts | Updates error and token validation assertions, including timestamp checks |
| sdk/identity/identity/test/internal/node/azureDeveloperCliCredential.spec.ts | Updates command validation assertion for --no-prompt flag check |
| sdk/identity/identity/test/internal/node/azureCliCredential.spec.ts | Updates error existence assertions for CLI credential tests |
| sdk/identity/identity-vscode/test/public/node/visualStudioCodeCredential.spec.ts | Updates token and timestamp validation assertions |
| sdk/identity/identity-cache-persistence/test/internal/node/usernamePasswordCredential.spec.ts | Updates cache token existence assertions |
| sdk/identity/identity-cache-persistence/test/internal/node/deviceCodeCredential.spec.ts | Updates cache token, account, and token validation assertions |
| sdk/identity/identity-cache-persistence/test/internal/node/clientSecretCredential.spec.ts | Updates cache token existence assertion |
| sdk/identity/identity-cache-persistence/test/internal/node/clientCertificateCredential.spec.ts | Updates cache token existence assertion |
sdk/identity/identity/test/public/node/deviceCodeCredential.spec.ts
Outdated
Show resolved
Hide resolved
sdk/identity/identity/test/public/node/environmentCredential.spec.ts
Outdated
Show resolved
Hide resolved
sdk/identity/identity/test/public/node/environmentCredential.spec.ts
Outdated
Show resolved
Hide resolved
|
Thanks for the review! |
No description provided.