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