Skip to content

Commit

Permalink
test: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
liweijie0812 committed Dec 3, 2024
1 parent 01fa5f8 commit ddeccab
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions test/pull_request/repo.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { context } from '@actions/github'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { start } from '../../src/index'

// vi.mock('@actions/github', () => ({
// context: {
Expand All @@ -14,20 +13,19 @@ describe('pull_request', () => {
vi.restoreAllMocks()
})
it('repo1', async () => {
start()
const { owner, repo } = context.repo
expect(owner).toBe('TDesignOteam')
expect(repo).toBe('tdesign-changelog-action')
expect(owner).toEqual('TDesignOteam')
expect(repo).toEqual('tdesign-changelog-action')
})
it('repo', async () => {
vi.spyOn(context, 'repo', 'get').mockReturnValue({
owner: 'test-owner',
repo: 'test-repo',
})
start()

const { owner, repo } = context.repo
expect(owner).toBe('test-owner')
expect(repo).toBe('test-repo')
expect(owner).toEqual('test-owner')
expect(repo).toEqual('test-repo')
})

it('repo2', async () => {
Expand All @@ -36,15 +34,13 @@ describe('pull_request', () => {
repo: 'test-repo',
})

const data = start()
const { owner, repo } = context.repo
expect(owner).toBe('test-owner1')
expect(repo).toBe('test-repo')
expect(data).toBe('test-owner1')
expect(owner).toEqual('test-owner1')
expect(repo).toEqual('test-repo')
})
it('repo5', async () => {
const { owner, repo } = context.repo
expect(owner).toBe('TDesignOteam')
expect(repo).toBe('tdesign-changelog-action')
expect(owner).toEqual('TDesignOteam')
expect(repo).toEqual('tdesign-changelog-action')
})
})

0 comments on commit ddeccab

Please sign in to comment.