File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ export type LimitOption<K extends keyof LimitOptionAll> = Pick<
11
11
>
12
12
13
13
export type LimitFn <
14
- T ,
15
- K extends keyof LimitOptionAll = keyof LimitOptionAll
14
+ K extends keyof LimitOptionAll = keyof LimitOptionAll ,
15
+ T = any
16
16
> = ( opt : LimitOption < K > , item : T , data : T [ ] ) => boolean
17
17
18
18
export const limitMaxCount =
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ export interface PaginatedOption<
5
5
L extends keyof LimitOptionAll = keyof LimitOptionAll ,
6
6
K = unknown
7
7
> {
8
- limit ?: LimitFn < T , L | 'total' >
8
+ limit ?: LimitFn < L | 'total' , T >
9
9
/**
10
10
* 当获取下一页时触发,返回 false 将停止获取下一页
11
11
*/
Original file line number Diff line number Diff line change
1
+ import { describe , expect , it } from 'vitest'
2
+ import { JikeClient , limit } from '../../src'
3
+ import { config , refreshToken } from '../config'
4
+
5
+ describe ( 'notifications should work' , ( ) => {
6
+ const client = new JikeClient ( { ...config , refreshToken } )
7
+
8
+ it ( 'queryNotifications should work' , async ( ) => {
9
+ const notifications = await client . queryNotifications ( {
10
+ limit : limit . limitMaxCount ( 100 ) ,
11
+ } )
12
+ expect ( notifications . length ) . toBe ( 100 )
13
+ } )
14
+ } )
You can’t perform that action at this time.
0 commit comments