mirror of
https://github.com/apache/superset.git
synced 2026-05-10 10:25:51 +00:00
build: inline external Github Actions to unblock CI (#12241)
* build: inline cached-dependencies to unblock CI * Run E2E on pull_request on;y * Inline all external actions * Checkout needed for internal actions Also fixes pre-commit * Add missing files
This commit is contained in:
67
.github/actions/file-changes-action/src/tests/UtilsHelper.test.ts
vendored
Normal file
67
.github/actions/file-changes-action/src/tests/UtilsHelper.test.ts
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
import {Env, p, getTestEvents} from './mocks/env'
|
||||
|
||||
let env: Env
|
||||
describe('Testing UtilsHelper.ts...', () => {
|
||||
describe('...with push event...', () => {
|
||||
beforeAll(() => {
|
||||
env = new Env({}, {githubToken: 'TestToken'}, 'push')
|
||||
})
|
||||
afterEach(() => {
|
||||
process.env = {...env.envStart}
|
||||
jest.resetModules()
|
||||
env = new Env({}, {}, 'push')
|
||||
})
|
||||
/**
|
||||
* @function getErrorString
|
||||
*/
|
||||
describe('...with function getErrorString...', () => {
|
||||
it('...can throw an error', () => {
|
||||
const error = require('../UtilsHelper').getErrorString()
|
||||
expect(JSON.stringify(JSON.parse(error))).toBe(
|
||||
JSON.stringify({error: '500/undefined', payload: ''})
|
||||
)
|
||||
})
|
||||
|
||||
it('...can throw an error for my error', () => {
|
||||
const {setFailed, error: coreError} = require('@actions/core')
|
||||
const obj = {a: {}}
|
||||
obj.a = {b: obj}
|
||||
expect(() =>
|
||||
require('../UtilsHelper').getErrorString(
|
||||
'test',
|
||||
200,
|
||||
'test',
|
||||
'test',
|
||||
obj
|
||||
)
|
||||
).toThrowError(
|
||||
JSON.stringify({
|
||||
name: '500/undefined',
|
||||
message: 'Error throwing error.'
|
||||
})
|
||||
)
|
||||
// expect(JSON.stringify(JSON.parse(error))).toBe(JSON.stringify({error:'500/undefined', payload:''}))
|
||||
expect(setFailed).toBeCalledWith(
|
||||
expect.stringContaining('Error throwing error.')
|
||||
)
|
||||
expect(coreError).toBeCalledWith(
|
||||
expect.stringContaining('Error throwing error.')
|
||||
)
|
||||
})
|
||||
})
|
||||
/**
|
||||
* @function errorMessage
|
||||
*/
|
||||
describe('...with function errorMessage...', () => {
|
||||
it.each(getTestEvents(p.errorMessageInputs, 'push'))(
|
||||
'...for function %s',
|
||||
(f, e, expected) => {
|
||||
const error = require('../UtilsHelper').errorMessage(f, e)
|
||||
expect(error).toBe(
|
||||
`${expected}\nException: ${JSON.stringify(e, null, 2)}`
|
||||
)
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user