mirror of
				https://github.com/gradle/gradle-build-action.git
				synced 2025-11-04 09:41:00 +08:00 
			
		
		
		
	Remove old caching code
This commit is contained in:
		@@ -2,40 +2,6 @@ import * as cacheUtils from '../src/cache-utils'
 | 
			
		||||
import * as path from 'path'
 | 
			
		||||
 | 
			
		||||
describe('cacheUtils-utils', () => {
 | 
			
		||||
    describe('can hash', () => {
 | 
			
		||||
        it('a directory', async () => {
 | 
			
		||||
            const hash = await cacheUtils.hashFiles(
 | 
			
		||||
                path.resolve('__tests__/data/crypto-utils-test/gradle')
 | 
			
		||||
            )
 | 
			
		||||
            expect(hash).toBe(
 | 
			
		||||
                process.platform === 'win32'
 | 
			
		||||
                    ? '3364336e94e746ce65a31748a6371b7efd7d499e18ad605c74c91cde0edc0a44'
 | 
			
		||||
                    : '63b9f14f65d014e585099c9c274b9dcbddf5cfd1a8978e5a24efb89ff9304348'
 | 
			
		||||
            )
 | 
			
		||||
        })
 | 
			
		||||
        it('a directory with a glob', async () => {
 | 
			
		||||
            const hash = await cacheUtils.hashFiles(
 | 
			
		||||
                path.resolve('__tests__/data/crypto-utils-test/'),
 | 
			
		||||
                ['gradle/**']
 | 
			
		||||
            )
 | 
			
		||||
            expect(hash).toBe(
 | 
			
		||||
                process.platform === 'win32'
 | 
			
		||||
                    ? '3364336e94e746ce65a31748a6371b7efd7d499e18ad605c74c91cde0edc0a44'
 | 
			
		||||
                    : '63b9f14f65d014e585099c9c274b9dcbddf5cfd1a8978e5a24efb89ff9304348'
 | 
			
		||||
            )
 | 
			
		||||
        })
 | 
			
		||||
        it('a directory with globs', async () => {
 | 
			
		||||
            const hash = await cacheUtils.hashFiles(
 | 
			
		||||
                path.resolve('__tests__/data/crypto-utils-test/'),
 | 
			
		||||
                ['**/*.gradle', 'gradle/**']
 | 
			
		||||
            )
 | 
			
		||||
            expect(hash).toBe(
 | 
			
		||||
                process.platform === 'win32'
 | 
			
		||||
                    ? 'd9b66fded38f79f601ce745d64ed726a8df8c0b242b02bcd2c1d331f54742ad6'
 | 
			
		||||
                    : 'f42cd10636f09799f4e01cc84e7ae906cc1d9140f1446f8dcd054d19cbc44c2b'
 | 
			
		||||
            )
 | 
			
		||||
        })
 | 
			
		||||
    })
 | 
			
		||||
    describe('can truncate args', () => {
 | 
			
		||||
        test('handles zero-length string', () => {
 | 
			
		||||
            expect(cacheUtils.truncateArgs('')).toBe('')
 | 
			
		||||
 
 | 
			
		||||
@@ -1,33 +0,0 @@
 | 
			
		||||
import * as cacheWrapper from '../src/cache-wrapper'
 | 
			
		||||
import * as path from 'path'
 | 
			
		||||
 | 
			
		||||
describe('cache', () => {
 | 
			
		||||
    describe('can extract gradle wrapper slug', () => {
 | 
			
		||||
        it('from wrapper properties file', async () => {
 | 
			
		||||
            const version = cacheWrapper.extractGradleWrapperSlugFrom(
 | 
			
		||||
                path.resolve(
 | 
			
		||||
                    '__tests__/data/cache-wrapper-test/gradle-wrapper.properties'
 | 
			
		||||
                )
 | 
			
		||||
            )
 | 
			
		||||
            expect(version).toBe('6.6.1-bin')
 | 
			
		||||
        })
 | 
			
		||||
        it('for -bin dist', async () => {
 | 
			
		||||
            const version = cacheWrapper.extractGradleWrapperSlugFromDistUri(
 | 
			
		||||
                'distributionUrl=https\\://services.gradle.org/distributions/gradle-6.6.1-bin.zip'
 | 
			
		||||
            )
 | 
			
		||||
            expect(version).toBe('6.6.1-bin')
 | 
			
		||||
        })
 | 
			
		||||
        it('for -all dist', async () => {
 | 
			
		||||
            const version = cacheWrapper.extractGradleWrapperSlugFromDistUri(
 | 
			
		||||
                'distributionUrl=https\\://services.gradle.org/distributions/gradle-6.6.1-all.zip'
 | 
			
		||||
            )
 | 
			
		||||
            expect(version).toBe('6.6.1-all')
 | 
			
		||||
        })
 | 
			
		||||
        it('for milestone', async () => {
 | 
			
		||||
            const version = cacheWrapper.extractGradleWrapperSlugFromDistUri(
 | 
			
		||||
                'distributionUrl=https\\://services.gradle.org/distributions/gradle-6.6-milestone-1-all.zip'
 | 
			
		||||
            )
 | 
			
		||||
            expect(version).toBe('6.6-milestone-1-all')
 | 
			
		||||
        })
 | 
			
		||||
    })
 | 
			
		||||
})
 | 
			
		||||
		Reference in New Issue
	
	Block a user