1
0
Fork 0
mirror of https://github.com/subosito/flutter-action.git synced 2024-08-16 10:19:50 +02:00
flutter/__tests__/installer.test.ts

40 lines
1.1 KiB
TypeScript
Raw Normal View History

2019-08-13 12:11:30 +02:00
import io = require('@actions/io');
import fs = require('fs');
import path = require('path');
const toolDir = path.join(__dirname, 'runner', 'tools');
process.env['RUNNER_TOOL_CACHE'] = toolDir;
import * as installer from '../src/installer';
describe('installer tests', () => {
beforeAll(async () => {
await io.rmRF(toolDir);
}, 300000);
afterAll(async () => {
try {
await io.rmRF(toolDir);
} catch {
console.log('Failed to remove test directories');
}
}, 100000);
it('Downloads flutter', async () => {
await installer.getFlutter('v1.7.8+hotfix.4', 'stable');
const sdkDir = path.join(toolDir, 'Flutter', 'v1.7.8+hotfix.4-stable');
expect(fs.existsSync(`${sdkDir}.complete`)).toBe(true);
expect(fs.existsSync(path.join(sdkDir, 'bin'))).toBe(true);
}, 100000);
it('Downloads flutter from beta channel', async () => {
await installer.getFlutter('v1.8.3', 'beta');
const sdkDir = path.join(toolDir, 'Flutter', 'v1.8.3-beta');
expect(fs.existsSync(`${sdkDir}.complete`)).toBe(true);
expect(fs.existsSync(path.join(sdkDir, 'bin'))).toBe(true);
}, 100000);
});