From ddeccabbe0c53f3aa71e8bf4d1d4c0ee7400edbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E4=BC=9F=E6=9D=B0?= <674416404@qq.com> Date: Tue, 3 Dec 2024 17:16:00 +0800 Subject: [PATCH] test: wip --- test/pull_request/repo.test.ts | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/test/pull_request/repo.test.ts b/test/pull_request/repo.test.ts index 54828f6..961a9b8 100644 --- a/test/pull_request/repo.test.ts +++ b/test/pull_request/repo.test.ts @@ -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: { @@ -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 () => { @@ -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') }) })