-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add coverage * feat: add more tests * fix: CI setup
- Loading branch information
1 parent
3c456c5
commit 2ec29c1
Showing
5 changed files
with
252 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { run } from '../src/run' | ||
|
||
import { vi, describe, it, expect } from 'vitest' | ||
|
||
describe('run', () => { | ||
vi.mock('@apollo/client/index.js', () => { | ||
class InMemoryCache { | ||
constructor() {} | ||
} | ||
|
||
class AppolloClient { | ||
constructor() {} | ||
|
||
query() { | ||
return { | ||
data: { | ||
repository: { | ||
pullRequests: { | ||
pageInfo: { | ||
hasNextPage: false, | ||
endCursor: 'endCursor' | ||
}, | ||
edges: [ | ||
{ | ||
node: { | ||
id: 'id' | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
return { | ||
ApolloClient: AppolloClient, | ||
InMemoryCache: InMemoryCache | ||
} | ||
}) | ||
|
||
vi.stubEnv('GITHUB_TOKEN', 'dummy-token') | ||
|
||
it('should run', async () => { | ||
/** we just want to ensure that `run` does not throw any errors */ | ||
expect( | ||
await run({ | ||
owner: 'owner', | ||
repo: 'repo', | ||
limit: 100 | ||
}) | ||
).toBeUndefined() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { defineConfig } from 'vitest/config' | ||
|
||
export default defineConfig({ | ||
test: { | ||
coverage: { | ||
enabled: true, | ||
exclude: [ | ||
'coverage/**', | ||
'codegen.ts', | ||
'**/__generated__/**', | ||
'bin/**', | ||
'dist/**', | ||
'**/[.]**', | ||
'**/*.d.ts', | ||
'**/*{.,-}{test,spec}.?(c|m)[jt]s?(x)', | ||
'**/__tests__/**', | ||
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*', | ||
'**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}' | ||
] | ||
} | ||
} | ||
}) |
Oops, something went wrong.