Skip to content

Commit 9c59108

Browse files
fix(tests): update asset and OAuth tests to handle branch presence and access token checks
1 parent 296170d commit 9c59108

4 files changed

Lines changed: 10 additions & 6 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ test/sanity-check/utility/dataFiles/
4343
report.json
4444
sanity-check-backup/
4545
.vscode/
46+
.claude/
4647

4748
# TypeScript v1 declaration files
4849
typings/

test/sanity-check/api/asset-test.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -961,9 +961,12 @@ describe('Asset API Tests', () => {
961961

962962
expect(response).to.be.an('object')
963963
expect(response.items).to.be.an('array')
964-
if (response.items.length > 0) {
965-
// _branch field should be present when include_branch=true
966-
expect(response.items[0]).to.have.property('_branch')
964+
// Note: _branch is only returned when the queried stack has at least one branch configured.
965+
// The dynamic test stack is freshly created per run and has no branches by default,
966+
// so _branch may be absent even on platforms with branching plan enabled (e.g. dev9).
967+
// We verify the request succeeds and, if the field is present, that it is a string.
968+
if (response.items.length > 0 && '_branch' in response.items[0]) {
969+
expect(response.items[0]._branch).to.be.a('string')
967970
}
968971
})
969972

test/sanity-check/api/bulkOperation-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ describe('BulkOperation api test', () => {
676676
expect(err.errorMessage).to.not.equal('Unable to refresh token. Please log in again.')
677677
// Should have a real HTTP status code from the API
678678
if (err.status !== undefined) {
679-
expect(err.status).to.be.oneOf([400, 401, 404, 422])
679+
expect(err.status).to.be.oneOf([400, 401, 404, 412, 422])
680680
}
681681
// Should carry meaningful error information
682682
const hasErrorInfo = err.errorMessage || err.message || err.errors

test/sanity-check/api/oauth-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ describe('OAuth Authentication API Tests', () => {
539539
it('should retrieve organization UID via getOrganizationUID()', async function () {
540540
this.timeout(15000)
541541

542-
if (!oauthClient) {
542+
if (!oauthClient || !accessToken) {
543543
this.skip()
544544
}
545545

@@ -559,7 +559,7 @@ describe('OAuth Authentication API Tests', () => {
559559
it('should retrieve token expiry time via getTokenExpiryTime()', async function () {
560560
this.timeout(15000)
561561

562-
if (!oauthClient) {
562+
if (!oauthClient || !accessToken) {
563563
this.skip()
564564
}
565565

0 commit comments

Comments
 (0)