Skip to content

Commit 83a8119

Browse files
committed
fix: enhance error messages for asset, concurrency queue, content type, and OAuth handler tests
1 parent 5e2d9c2 commit 83a8119

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

test/unit/asset-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ describe('Contentstack Asset test', () => {
401401
done()
402402
})
403403
.catch((err) => {
404-
expect(err.message).to.be.equal('Asset URL can not be empty')
404+
expect(err.message).to.be.equal('Asset URL is required. Provide a valid asset URL and try again.')
405405
done()
406406
})
407407
})
@@ -415,7 +415,7 @@ describe('Contentstack Asset test', () => {
415415
})
416416
.download({ responseType: 'blob' })
417417
.catch((err) => {
418-
expect(err.message).to.be.equal('Asset URL can not be empty')
418+
expect(err.message).to.be.equal('Asset URL is required. Provide a valid asset URL and try again.')
419419
done()
420420
})
421421
})

test/unit/concurrency-Queue-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ describe('Concurrency queue test', () => {
189189
new ConcurrencyQueue({ axios: undefined })
190190
expect.fail('Undefined axios should fail')
191191
} catch (error) {
192-
expect(error.message).to.be.equal('Axios instance is not present')
192+
expect(error.message).to.be.equal('Axios instance is not present. Initialize the HTTP client and try again.')
193193
done()
194194
}
195195
})
@@ -232,7 +232,7 @@ describe('Concurrency queue test', () => {
232232
makeConcurrencyQueue({ maxRequests: -10 })
233233
expect.fail('Negative concurrency queue should fail')
234234
} catch (error) {
235-
expect(error.message).to.be.equal('Concurrency Manager Error: minimum concurrent requests is 1')
235+
expect(error.message).to.be.equal('Concurrency Manager Error: Minimum concurrent requests must be at least 1.')
236236
done()
237237
}
238238
})
@@ -242,7 +242,7 @@ describe('Concurrency queue test', () => {
242242
makeConcurrencyQueue({ retryLimit: -10 })
243243
expect.fail('Negative retry limit should fail')
244244
} catch (error) {
245-
expect(error.message).to.be.equal('Retry Policy Error: minimum retry limit is 1')
245+
expect(error.message).to.be.equal('Retry Policy Error: Minimum retry limit must be at least 1.')
246246
done()
247247
}
248248
})
@@ -252,7 +252,7 @@ describe('Concurrency queue test', () => {
252252
makeConcurrencyQueue({ retryDelay: 10 })
253253
expect.fail('Retry delay should be min 300ms')
254254
} catch (error) {
255-
expect(error.message).to.be.equal('Retry Policy Error: minimum retry delay for requests is 300')
255+
expect(error.message).to.be.equal('Retry Policy Error: Minimum retry delay must be at least 300ms.')
256256
done()
257257
}
258258
})

test/unit/contentType-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ describe('Contentstack ContentType test', () => {
8888

8989
it('ContentType generate UID from content type name test', done => {
9090
const contentType = makeContentType()
91-
expect(contentType.generateUid.bind(contentType, null)).to.throw('Expected parameter name')
91+
expect(contentType.generateUid.bind(contentType, null)).to.throw('Parameter name is required. Provide a valid parameter name and try again.')
9292
expect(contentType.generateUid('Test Name')).to.be.equal('test_name')
9393
expect(contentType.generateUid('Test @Name')).to.be.equal('test_name')
9494
expect(contentType.generateUid('12 Test Name')).to.be.equal('12_test_name')

test/unit/oauthHandler-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ describe('OAuthHandler', () => {
288288
await oauthHandler.getOauthAppAuthorization()
289289
throw new Error('Expected error not thrown')
290290
} catch (error) {
291-
expect(error.message).to.equal('No authorizations found for current user!')
291+
expect(error.message).to.equal('No authorizations found for the current user. Verify user permissions and try again.')
292292
}
293293
})
294294

@@ -301,7 +301,7 @@ describe('OAuthHandler', () => {
301301
await oauthHandler.getOauthAppAuthorization()
302302
throw new Error('Expected error not thrown')
303303
} catch (error) {
304-
expect(error.message).to.equal('No authorizations found for the app!')
304+
expect(error.message).to.equal('No authorizations found for the app. Verify app configuration and try again.')
305305
}
306306
})
307307
})

0 commit comments

Comments
 (0)