Skip to content

Commit 58e701e

Browse files
committed
fixed tests
1 parent b92c220 commit 58e701e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tests/utilsTests.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@ describe('Utils Unit Tests', (): void => {
152152

153153
describe('syncRequestWithRetry', (): void => {
154154
it('should return response on successful request (2xx)', (): void => {
155-
const response = jfrogUtils.syncRequestWithRetry('GET', 'https://httpstat.us/200', { timeout: 5000 });
155+
const response: { statusCode: number } = jfrogUtils.syncRequestWithRetry('GET', 'https://httpstat.us/200', { timeout: 5000 });
156156
assert.strictEqual(response.statusCode, 200);
157157
});
158158

159159
it('should return response on 4xx client error without retry', (): void => {
160-
const response = jfrogUtils.syncRequestWithRetry('GET', 'https://httpstat.us/404', { timeout: 5000 });
160+
const response: { statusCode: number } = jfrogUtils.syncRequestWithRetry('GET', 'https://httpstat.us/404', { timeout: 5000 });
161161
assert.strictEqual(response.statusCode, 404);
162162
});
163163

@@ -183,31 +183,31 @@ describe('Utils Unit Tests', (): void => {
183183
describe('isCliBinaryAvailable', (): void => {
184184
it('should return true for a known valid CLI version', (): void => {
185185
// Use a known stable version that should always be available
186-
const result = jfrogUtils.isCliBinaryAvailable('2.50.0');
186+
const result: boolean = jfrogUtils.isCliBinaryAvailable('2.50.0');
187187
assert.strictEqual(result, true);
188188
});
189189

190190
it('should return false for a non-existent CLI version', (): void => {
191-
const result = jfrogUtils.isCliBinaryAvailable('0.0.1');
191+
const result: boolean = jfrogUtils.isCliBinaryAvailable('0.0.1');
192192
assert.strictEqual(result, false);
193193
});
194194

195195
it('should return false for an invalid version format', (): void => {
196-
const result = jfrogUtils.isCliBinaryAvailable('invalid-version');
196+
const result: boolean = jfrogUtils.isCliBinaryAvailable('invalid-version');
197197
assert.strictEqual(result, false);
198198
});
199199
});
200200

201201
describe('fetchLatestCliVersion', (): void => {
202202
it('should return a valid semver version string', (): void => {
203-
const version = jfrogUtils.fetchLatestCliVersion();
203+
const version: string = jfrogUtils.fetchLatestCliVersion();
204204
// Version should match semver pattern (e.g., "2.89.0")
205205
assert.match(version, /^\d+\.\d+\.\d+$/);
206206
});
207207

208208
it('should return version >= 2.50.0 (reasonable minimum)', (): void => {
209-
const version = jfrogUtils.fetchLatestCliVersion();
210-
const [major, minor] = version.split('.').map(Number);
209+
const version: string = jfrogUtils.fetchLatestCliVersion();
210+
const [major, minor]: number[] = version.split('.').map(Number);
211211
assert.ok(major >= 2, `Major version ${major} should be >= 2`);
212212
if (major === 2) {
213213
assert.ok(minor >= 50, `Minor version ${minor} should be >= 50 for major version 2`);
@@ -224,7 +224,7 @@ describe('Utils Unit Tests', (): void => {
224224
it('should match the result of fetchLatestCliVersion', (): void => {
225225
// Since defaultJfrogCliVersion is set at module load, it should match fetchLatestCliVersion
226226
// unless there was a failure (in which case both would use fallback)
227-
const fetchedVersion = jfrogUtils.fetchLatestCliVersion();
227+
const fetchedVersion: string = jfrogUtils.fetchLatestCliVersion();
228228
assert.strictEqual(jfrogUtils.defaultJfrogCliVersion, fetchedVersion);
229229
});
230230
});
@@ -237,7 +237,7 @@ describe('Utils Unit Tests', (): void => {
237237

238238
it('should have an available binary on releases.jfrog.io', (): void => {
239239
// The fallback version should always have its binary available
240-
const result = jfrogUtils.isCliBinaryAvailable(jfrogUtils.fallbackCliVersion);
240+
const result: boolean = jfrogUtils.isCliBinaryAvailable(jfrogUtils.fallbackCliVersion);
241241
assert.strictEqual(result, true, `Fallback version ${jfrogUtils.fallbackCliVersion} should have available binary`);
242242
});
243243
});

0 commit comments

Comments
 (0)