Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace deprecated createCaller #189

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions test/server/auth.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { healthCheckerRouter } from '../../src/app/api/trpc/trpc-router'
import { Octomock } from '../octomock'
import { createTestContext } from '../utils/auth'
import { t } from '../../src/utils/trpc-server'
const om = new Octomock()

jest.mock('../../src/bot/octokit', () => ({
Expand All @@ -14,7 +15,8 @@ describe('Git router', () => {
})

it('should allow users that are authenticated', async () => {
const caller = healthCheckerRouter.createCaller(createTestContext())
const caller =
t.createCallerFactory(healthCheckerRouter)(createTestContext())

om.mockFunctions.rest.users.getAuthenticated.mockResolvedValue({
status: 200,
Expand All @@ -33,7 +35,7 @@ describe('Git router', () => {
})

it('should throw on invalid sessions', async () => {
const caller = healthCheckerRouter.createCaller(
const caller = t.createCallerFactory(healthCheckerRouter)(
createTestContext({
user: {
name: 'fake-username',
Expand Down
11 changes: 6 additions & 5 deletions test/server/repos.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import * as auth from '../../src/utils/auth'
import reposRouter from '../../src/server/repos/router'
import { Octomock } from '../octomock'
import { createTestContext } from '../utils/auth'
import { t } from '../../src/utils/trpc-server'
const om = new Octomock()

jest.mock('../../src/bot/config')
Expand Down Expand Up @@ -106,7 +107,7 @@ describe('Repos router', () => {
})

it('should create a mirror when repo does not exist exist', async () => {
const caller = reposRouter.createCaller(createTestContext())
const caller = t.createCallerFactory(reposRouter)(createTestContext())

const configSpy = jest.spyOn(config, 'getConfig').mockResolvedValue({
publicOrg: 'github',
Expand Down Expand Up @@ -151,7 +152,7 @@ describe('Repos router', () => {
})

it('should throw an error when repo already exists', async () => {
const caller = reposRouter.createCaller(createTestContext())
const caller = t.createCallerFactory(reposRouter)(createTestContext())

const configSpy = jest.spyOn(config, 'getConfig').mockResolvedValue({
publicOrg: 'github',
Expand Down Expand Up @@ -185,7 +186,7 @@ describe('Repos router', () => {
})

it('should cleanup repos when there is an error', async () => {
const caller = reposRouter.createCaller(createTestContext())
const caller = t.createCallerFactory(reposRouter)(createTestContext())

const configSpy = jest.spyOn(config, 'getConfig').mockResolvedValue({
publicOrg: 'github',
Expand Down Expand Up @@ -225,7 +226,7 @@ describe('Repos router', () => {
})

it('dual-org: should cleanup repos when there is an error', async () => {
const caller = reposRouter.createCaller(createTestContext())
const caller = t.createCallerFactory(reposRouter)(createTestContext())

const configSpy = jest.spyOn(config, 'getConfig').mockResolvedValue({
publicOrg: 'github',
Expand Down Expand Up @@ -265,7 +266,7 @@ describe('Repos router', () => {
})

it('reject repository names over the character limit', async () => {
const caller = reposRouter.createCaller(createTestContext())
const caller = t.createCallerFactory(reposRouter)(createTestContext())

await caller
.createMirror({
Expand Down
Loading