11import { expect , test } from 'vitest' ;
22import { getBasicDocument } from '../mocks/get-basic-document' ;
3- import { filterUrl } from '../../src/lib/filter-url ' ;
3+ import { filterUri } from '../../src/lib/filter-uri ' ;
44
55test ( '未指定过滤路由则不处理' , ( ) => {
66 const docs = getBasicDocument ( {
@@ -10,7 +10,7 @@ test('未指定过滤路由则不处理', () => {
1010 '/other' : { } ,
1111 } ) ;
1212
13- filterUrl ( docs , { url : '' } ) ;
13+ filterUri ( docs , { url : '' } ) ;
1414 expect ( Object . keys ( docs . paths ) ) . toMatchInlineSnapshot ( `
1515 [
1616 "/",
@@ -19,7 +19,7 @@ test('未指定过滤路由则不处理', () => {
1919 "/other",
2020 ]
2121 ` ) ;
22- filterUrl ( docs , { url : '' , includeUriPrefix : [ ] } ) ;
22+ filterUri ( docs , { url : '' , includeUriPrefix : [ ] } ) ;
2323 expect ( Object . keys ( docs . paths ) ) . toMatchInlineSnapshot ( `
2424 [
2525 "/",
@@ -38,7 +38,7 @@ test('不符合前缀的路由被删除', () => {
3838 '/other' : { } ,
3939 } ) ;
4040
41- filterUrl ( docs , { url : '' , includeUriPrefix : '/test' } ) ;
41+ filterUri ( docs , { url : '' , includeUriPrefix : '/test' } ) ;
4242 expect ( Object . keys ( docs . paths ) ) . toMatchInlineSnapshot ( `
4343 [
4444 "/test/a",
@@ -56,7 +56,7 @@ test('同时过滤多个路由', () => {
5656 '/foo/bar' : { } ,
5757 } ) ;
5858
59- filterUrl ( docs , { url : '' , includeUriPrefix : [ '/test' , '/foo' ] } ) ;
59+ filterUri ( docs , { url : '' , includeUriPrefix : [ '/test' , '/foo' ] } ) ;
6060 expect ( Object . keys ( docs . paths ) ) . toMatchInlineSnapshot ( `
6161 [
6262 "/test/a",
@@ -75,7 +75,7 @@ test('支持正则表达式', () => {
7575 '/foo/bar' : { } ,
7676 } ) ;
7777
78- filterUrl ( docs , { url : '' , includeUriPrefix : [ / \/ a / ] } ) ;
78+ filterUri ( docs , { url : '' , includeUriPrefix : [ / \/ a / ] } ) ;
7979 expect ( Object . keys ( docs . paths ) ) . toMatchInlineSnapshot ( `
8080 [
8181 "/test/a",
0 commit comments