11import type { Octokit } from '@octokit/rest' ;
2+ import { describe , expect , it , vi } from 'vitest' ;
23
34import { OPT_OUT_LABEL , PROPOSAL_MARKER } from './constants' ;
45import {
@@ -25,7 +26,7 @@ describe('github-api', () => {
2526 } ) ;
2627
2728 it ( 'resolves the client PR including fork and opt-out label' , async ( ) => {
28- const pullsGet = jest . fn ( ) . mockResolvedValue ( {
29+ const pullsGet = vi . fn ( ) . mockResolvedValue ( {
2930 data : {
3031 number : 12 ,
3132 base : { sha : 'base' } ,
@@ -57,7 +58,7 @@ describe('github-api', () => {
5758 } ) ;
5859
5960 it ( 'finds an open schema PR by bot head branch' , async ( ) => {
60- const pullsList = jest . fn ( ) . mockResolvedValue ( {
61+ const pullsList = vi . fn ( ) . mockResolvedValue ( {
6162 data : [
6263 {
6364 number : 9 ,
@@ -84,7 +85,7 @@ describe('github-api', () => {
8485 } ) ;
8586
8687 it ( 'creates a draft schema PR' , async ( ) => {
87- const pullsCreate = jest . fn ( ) . mockResolvedValue ( {
88+ const pullsCreate = vi . fn ( ) . mockResolvedValue ( {
8889 data : {
8990 number : 3 ,
9091 [ HTML_URL ] : 'https://github.com/Consensys/segment-schema/pull/3' ,
@@ -110,15 +111,15 @@ describe('github-api', () => {
110111 } ) ;
111112
112113 it ( 'edits the existing proposal comment instead of posting a second one' , async ( ) => {
113- const paginate = jest . fn ( ) . mockResolvedValue ( [
114+ const paginate = vi . fn ( ) . mockResolvedValue ( [
114115 {
115116 id : 77 ,
116117 body : `${ PROPOSAL_MARKER } \nold` ,
117118 user : { login : 'github-actions[bot]' } ,
118119 } ,
119120 ] ) ;
120- const updateComment = jest . fn ( ) . mockResolvedValue ( { } ) ;
121- const createComment = jest . fn ( ) . mockResolvedValue ( { } ) ;
121+ const updateComment = vi . fn ( ) . mockResolvedValue ( { } ) ;
122+ const createComment = vi . fn ( ) . mockResolvedValue ( { } ) ;
122123 const octokit = {
123124 paginate,
124125 issues : { updateComment, createComment } ,
@@ -140,15 +141,15 @@ describe('github-api', () => {
140141 } ) ;
141142
142143 it ( 'updates an existing proposal comment and skips create' , async ( ) => {
143- const paginate = jest . fn ( ) . mockResolvedValue ( [
144+ const paginate = vi . fn ( ) . mockResolvedValue ( [
144145 {
145146 id : 77 ,
146147 body : `${ PROPOSAL_MARKER } \nold` ,
147148 user : { login : 'github-actions[bot]' } ,
148149 } ,
149150 ] ) ;
150- const updateComment = jest . fn ( ) . mockResolvedValue ( { } ) ;
151- const createComment = jest . fn ( ) . mockResolvedValue ( { } ) ;
151+ const updateComment = vi . fn ( ) . mockResolvedValue ( { } ) ;
152+ const createComment = vi . fn ( ) . mockResolvedValue ( { } ) ;
152153 const octokit = {
153154 paginate,
154155 issues : { updateComment, createComment } ,
@@ -171,9 +172,9 @@ describe('github-api', () => {
171172 } ) ;
172173
173174 it ( 'no-ops when no proposal comment exists' , async ( ) => {
174- const paginate = jest . fn ( ) . mockResolvedValue ( [ ] ) ;
175- const updateComment = jest . fn ( ) . mockResolvedValue ( { } ) ;
176- const createComment = jest . fn ( ) . mockResolvedValue ( { } ) ;
175+ const paginate = vi . fn ( ) . mockResolvedValue ( [ ] ) ;
176+ const updateComment = vi . fn ( ) . mockResolvedValue ( { } ) ;
177+ const createComment = vi . fn ( ) . mockResolvedValue ( { } ) ;
177178 const octokit = {
178179 paginate,
179180 issues : { updateComment, createComment } ,
@@ -191,15 +192,15 @@ describe('github-api', () => {
191192 } ) ;
192193
193194 it ( 'ignores a proposal marker posted by someone else' , async ( ) => {
194- const paginate = jest . fn ( ) . mockResolvedValue ( [
195+ const paginate = vi . fn ( ) . mockResolvedValue ( [
195196 {
196197 id : 88 ,
197198 body : `${ PROPOSAL_MARKER } \nplanted` ,
198199 user : { login : 'alice' } ,
199200 } ,
200201 ] ) ;
201- const updateComment = jest . fn ( ) . mockResolvedValue ( { } ) ;
202- const createComment = jest . fn ( ) . mockResolvedValue ( { } ) ;
202+ const updateComment = vi . fn ( ) . mockResolvedValue ( { } ) ;
203+ const createComment = vi . fn ( ) . mockResolvedValue ( { } ) ;
203204 const octokit = {
204205 paginate,
205206 issues : { updateComment, createComment } ,
0 commit comments