11import { afterEach , beforeEach , describe , expect , it , vi } from "vitest" ;
2- import { validProjectResponse , validServiceConfig } from "../../mocks.js" ;
2+ import { validServiceConfig , validTeamResponse } from "../../mocks.js" ;
33import { updateRateLimitedAt } from "../api.js" ;
44import { rateLimit } from "./index.js" ;
55
@@ -27,7 +27,7 @@ describe("rateLimit", () => {
2727
2828 it ( "should not rate limit if service scope is not in rate limits" , async ( ) => {
2929 const result = await rateLimit ( {
30- project : validProjectResponse ,
30+ team : validTeamResponse ,
3131 limitPerSecond : 0 ,
3232 serviceConfig : validServiceConfig ,
3333 redis : mockRedis ,
@@ -44,7 +44,7 @@ describe("rateLimit", () => {
4444 mockRedis . incr . mockResolvedValue ( 50 ) ; // Current count is 50 requests in 10 seconds.
4545
4646 const result = await rateLimit ( {
47- project : validProjectResponse ,
47+ team : validTeamResponse ,
4848 limitPerSecond : 5 ,
4949 serviceConfig : validServiceConfig ,
5050 redis : mockRedis ,
@@ -63,7 +63,7 @@ describe("rateLimit", () => {
6363 mockRedis . incr . mockResolvedValue ( 51 ) ;
6464
6565 const result = await rateLimit ( {
66- project : validProjectResponse ,
66+ team : validTeamResponse ,
6767 limitPerSecond : 5 ,
6868 serviceConfig : validServiceConfig ,
6969 redis : mockRedis ,
@@ -85,7 +85,7 @@ describe("rateLimit", () => {
8585 mockRedis . incr . mockResolvedValue ( 1 ) ;
8686
8787 const result = await rateLimit ( {
88- project : validProjectResponse ,
88+ team : validTeamResponse ,
8989 limitPerSecond : 5 ,
9090 serviceConfig : validServiceConfig ,
9191 redis : mockRedis ,
@@ -104,7 +104,7 @@ describe("rateLimit", () => {
104104 vi . spyOn ( global . Math , "random" ) . mockReturnValue ( 0.08 ) ;
105105
106106 const result = await rateLimit ( {
107- project : validProjectResponse ,
107+ team : validTeamResponse ,
108108 limitPerSecond : 5 ,
109109 serviceConfig : validServiceConfig ,
110110 redis : mockRedis ,
@@ -127,7 +127,7 @@ describe("rateLimit", () => {
127127 vi . spyOn ( global . Math , "random" ) . mockReturnValue ( 0.15 ) ;
128128
129129 const result = await rateLimit ( {
130- project : validProjectResponse ,
130+ team : validTeamResponse ,
131131 limitPerSecond : 5 ,
132132 serviceConfig : validServiceConfig ,
133133 redis : mockRedis ,
0 commit comments