mirror of
https://forgejo.stefka.eu/jiriks74/create-pull-request.git
synced 2025-01-18 16:01:06 +01:00
Add integration testing
This commit is contained in:
parent
172ec762f8
commit
498d78cb23
5 changed files with 85 additions and 14 deletions
26
__test__/git.unit.test.ts
Normal file
26
__test__/git.unit.test.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
import * as path from 'path'
|
||||
import {getRepoPath} from '../lib/git'
|
||||
|
||||
const originalGitHubWorkspace = process.env['GITHUB_WORKSPACE']
|
||||
|
||||
describe('git tests', () => {
|
||||
beforeAll(() => {
|
||||
// GitHub workspace
|
||||
process.env['GITHUB_WORKSPACE'] = __dirname
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
// Restore GitHub workspace
|
||||
delete process.env['GITHUB_WORKSPACE']
|
||||
if (originalGitHubWorkspace) {
|
||||
process.env['GITHUB_WORKSPACE'] = originalGitHubWorkspace
|
||||
}
|
||||
})
|
||||
|
||||
test('getRepoPath', async () => {
|
||||
expect(getRepoPath()).toEqual(process.env['GITHUB_WORKSPACE'])
|
||||
expect(getRepoPath('foo')).toEqual(
|
||||
path.resolve(process.env['GITHUB_WORKSPACE'] || '', 'foo')
|
||||
)
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue