Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions __tests__/installer/linux.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as path from 'path'
import * as exec from '@actions/exec'
import * as cache from '@actions/cache'
import * as toolCache from '@actions/tool-cache'
import {coerce as parseSemVer} from 'semver'
import {LinuxToolchainInstaller} from '../../src/installer/linux'
Expand Down Expand Up @@ -34,6 +35,8 @@ describe('linux toolchain installation verification', () => {
)

const download = path.resolve('tool', 'download', 'path')
jest.spyOn(cache, 'restoreCache').mockResolvedValue(undefined)
jest.spyOn(cache, 'saveCache').mockResolvedValue(1)
jest.spyOn(toolCache, 'downloadTool').mockResolvedValue(download)
jest.spyOn(exec, 'exec').mockResolvedValue(0)
await expect(installer['download']()).resolves.toBe(download)
Expand Down Expand Up @@ -65,6 +68,8 @@ describe('linux toolchain installation verification', () => {
const extracted = path.resolve('tool', 'extracted', 'path')
const cached = path.resolve('tool', 'cached', 'path')
const swiftPath = path.join(cached, 'usr', 'bin')
jest.spyOn(cache, 'restoreCache').mockResolvedValue(undefined)
jest.spyOn(cache, 'saveCache').mockResolvedValue(1)
jest.spyOn(toolCache, 'find').mockReturnValue('')
const downloadSpy = jest.spyOn(toolCache, 'downloadTool')
downloadSpy.mockResolvedValue(download)
Expand Down
3 changes: 3 additions & 0 deletions __tests__/installer/windows.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as path from 'path'
import {promises as fs} from 'fs'
import * as exec from '@actions/exec'
import * as cache from '@actions/cache'
import * as toolCache from '@actions/tool-cache'
import {coerce as parseSemVer} from 'semver'
import {WindowsToolchainInstaller} from '../../src/installer/windows'
Expand Down Expand Up @@ -53,6 +54,8 @@ describe('windows toolchain installation verification', () => {
stdout: JSON.stringify([visualStudio]),
stderr: ''
})
jest.spyOn(cache, 'restoreCache').mockResolvedValue(undefined)
jest.spyOn(cache, 'saveCache').mockResolvedValue(1)
jest.spyOn(toolCache, 'downloadTool').mockResolvedValue(download)
jest.spyOn(exec, 'exec').mockResolvedValue(0)
await expect(installer['download']()).resolves.toBe(`${download}.exe`)
Expand Down
5 changes: 5 additions & 0 deletions __tests__/installer/xcode.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as path from 'path'
import {promises as fs} from 'fs'
import * as exec from '@actions/exec'
import * as cache from '@actions/cache'
import * as toolCache from '@actions/tool-cache'
import {coerce as parseSemVer} from 'semver'
import * as plist from 'plist'
Expand Down Expand Up @@ -56,6 +57,8 @@ describe('macOS toolchain installation verification', () => {

const download = path.resolve('tool', 'download', 'path')
jest.spyOn(installer, 'isInstallationNeeded').mockResolvedValue(true)
jest.spyOn(cache, 'restoreCache').mockResolvedValue(undefined)
jest.spyOn(cache, 'saveCache').mockResolvedValue(1)
jest.spyOn(toolCache, 'downloadTool').mockResolvedValue(download)
jest.spyOn(exec, 'exec').mockResolvedValue(0)
await expect(installer['download']()).resolves.toBe(download)
Expand Down Expand Up @@ -95,6 +98,8 @@ describe('macOS toolchain installation verification', () => {
const swiftPath = path.join(cached, 'usr', 'bin')
const identifier = 'org.swift.581202305171a'
jest.spyOn(installer, 'isInstallationNeeded').mockResolvedValue(true)
jest.spyOn(cache, 'restoreCache').mockResolvedValue(undefined)
jest.spyOn(cache, 'saveCache').mockResolvedValue(1)
jest.spyOn(toolCache, 'find').mockReturnValue('')
jest.spyOn(exec, 'exec').mockResolvedValue(0)
const downloadSpy = jest.spyOn(toolCache, 'downloadTool')
Expand Down
Loading