2020-06-14 18:46:49 +02:00
|
|
|
import * as cacheWrapper from '../src/cache-wrapper'
|
2020-06-13 15:40:10 +02:00
|
|
|
import * as path from 'path'
|
|
|
|
|
|
|
|
describe('cache', () => {
|
|
|
|
describe('can extract gradle wrapper slug', () => {
|
|
|
|
it('from wrapper properties file', async () => {
|
2020-06-14 18:46:49 +02:00
|
|
|
const version = cacheWrapper.extractGradleWrapperSlugFrom(
|
2020-06-13 15:40:10 +02:00
|
|
|
path.resolve(
|
2021-07-05 14:33:02 -06:00
|
|
|
'__tests__/data/cache-wrapper-test/gradle-wrapper.properties'
|
2020-06-13 15:40:10 +02:00
|
|
|
)
|
|
|
|
)
|
2020-09-13 13:17:19 +02:00
|
|
|
expect(version).toBe('6.6.1-bin')
|
2020-06-13 15:40:10 +02:00
|
|
|
})
|
|
|
|
it('for -bin dist', async () => {
|
2020-06-14 18:46:49 +02:00
|
|
|
const version = cacheWrapper.extractGradleWrapperSlugFromDistUri(
|
2020-09-13 13:17:19 +02:00
|
|
|
'distributionUrl=https\\://services.gradle.org/distributions/gradle-6.6.1-bin.zip'
|
2020-06-13 15:40:10 +02:00
|
|
|
)
|
2020-09-13 13:17:19 +02:00
|
|
|
expect(version).toBe('6.6.1-bin')
|
2020-06-13 15:40:10 +02:00
|
|
|
})
|
|
|
|
it('for -all dist', async () => {
|
2020-06-14 18:46:49 +02:00
|
|
|
const version = cacheWrapper.extractGradleWrapperSlugFromDistUri(
|
2020-09-13 13:17:19 +02:00
|
|
|
'distributionUrl=https\\://services.gradle.org/distributions/gradle-6.6.1-all.zip'
|
2020-06-13 15:40:10 +02:00
|
|
|
)
|
2020-09-13 13:17:19 +02:00
|
|
|
expect(version).toBe('6.6.1-all')
|
2020-06-13 15:40:10 +02:00
|
|
|
})
|
|
|
|
it('for milestone', async () => {
|
2020-06-14 18:46:49 +02:00
|
|
|
const version = cacheWrapper.extractGradleWrapperSlugFromDistUri(
|
2020-06-13 15:40:10 +02:00
|
|
|
'distributionUrl=https\\://services.gradle.org/distributions/gradle-6.6-milestone-1-all.zip'
|
|
|
|
)
|
|
|
|
expect(version).toBe('6.6-milestone-1-all')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|