Update action binary

This commit is contained in:
Qiao Han
2022-08-03 22:43:59 +08:00
parent 4359afaaf1
commit 78c4398270
10 changed files with 4866 additions and 352 deletions

View File

@@ -1,25 +1,21 @@
import {wait} from '../src/wait'
import {getDownloadObject} from '../src/utils'
import * as os from 'os'
import * as process from 'process'
import * as cp from 'child_process'
import * as path from 'path'
import {expect, test} from '@jest/globals'
test('throws invalid number', async () => {
const input = parseInt('foo', 10)
await expect(wait(input)).rejects.toThrow('milliseconds not a number')
})
test('wait 500 ms', async () => {
const start = new Date()
await wait(500)
const end = new Date()
var delta = Math.abs(end.getTime() - start.getTime())
expect(delta).toBeGreaterThan(450)
test('returns download path to binary', async () => {
const link = getDownloadObject('0.1.0')
expect(link.url).toContain(
'https://github.com/supabase/cli/releases/download/v0.1.0/'
)
})
// shows how the runner will run a javascript action with env / stdout protocol
test('test runs', () => {
process.env['INPUT_MILLISECONDS'] = '500'
process.env['RUNNER_TEMP'] = os.tmpdir()
process.env['INPUT_VERSION'] = '0.32.1'
const np = process.execPath
const ip = path.join(__dirname, '..', 'lib', 'main.js')
const options: cp.ExecFileSyncOptions = {