@@ -9,13 +9,13 @@ import {
99
1010describe ( 'extractModelNameFromRoute' , ( ) => {
1111 it . each `
12- namespace | route | expected
13- ${ 'wc/blocks' } | ${ 'wc/blocks/products' } | ${ 'products' }
14- ${ 'wc/other' } | ${ 'wc/blocks/product' } | ${ 'wc/blocks/product' }
15- ${ 'wc/blocks' } | ${ 'wc/blocks/products/attributes/(?P<attribute_id>[d]+)' } | ${ 'products/attributes' }
16- ${ 'wc/blocks' } | ${ 'wc/blocks/products/attributes/(?P<attribute_id>[d]+)/terms' } | ${ 'products/attributes/terms' }
17- ${ 'wc/blocks' } | ${ 'wc/blocks/products/attributes/(?P<attribute_id>[d]+)/terms/(?P<id>[d]+)' } | ${ 'products/attributes/terms' }
18- ${ 'wc/blocks' } | ${ 'wc/blocks/cart/(?P<id>[s]+)' } | ${ 'cart' }
12+ namespace | route | expected
13+ ${ 'wc/blocks' } | ${ 'wc/blocks/products' } | ${ 'products' }
14+ ${ 'wc/other' } | ${ 'wc/blocks/product' } | ${ 'wc/blocks/product' }
15+ ${ 'wc/blocks' } | ${ 'wc/blocks/products/attributes/(?P<attribute_id>[\\ d]+)' } | ${ 'products/attributes' }
16+ ${ 'wc/blocks' } | ${ 'wc/blocks/products/attributes/(?P<attribute_id>[\\ d]+)/terms' } | ${ 'products/attributes/terms' }
17+ ${ 'wc/blocks' } | ${ 'wc/blocks/products/attributes/(?P<attribute_id>[\\ d]+)/terms/(?P<id>[d]+)' } | ${ 'products/attributes/terms' }
18+ ${ 'wc/blocks' } | ${ 'wc/blocks/cart/(?P<id>[\\ s]+)' } | ${ 'cart' }
1919 ` (
2020 'returns "$expected" when namespace is "$namespace" and route is "$route"' ,
2121 ( { namespace, route, expected } ) => {
@@ -28,10 +28,10 @@ describe( 'extractModelNameFromRoute', () => {
2828
2929describe ( 'getRouteIds' , ( ) => {
3030 it . each `
31- route | expected
32- ${ 'wc/blocks/products' } | ${ [ ] }
33- ${ 'wc/blocks/products/(?P<id>[d]+)' } | ${ [ 'id' ] }
34- ${ 'wc/blocks/products/attributes/(?P<attribute_id>[d]+)/terms/(?P<id>[d]+)' } | ${ [ 'attribute_id' , 'id' ] }
31+ route | expected
32+ ${ 'wc/blocks/products' } | ${ [ ] }
33+ ${ 'wc/blocks/products/(?P<id>[\\ d]+)' } | ${ [ 'id' ] }
34+ ${ 'wc/blocks/products/attributes/(?P<attribute_id>[\\ d]+)/terms/(?P<id>[\\ d]+)' } | ${ [ 'attribute_id' , 'id' ] }
3535 ` (
3636 'returns "$expected" when route is "$route"' ,
3737 ( { route, expected } ) => {
@@ -42,14 +42,14 @@ describe( 'getRouteIds', () => {
4242
4343describe ( 'simplifyRouteWithId' , ( ) => {
4444 it . each `
45- route | matchIds | expected
46- ${ 'wc/blocks/products' } | ${ [ ] } | ${ 'wc/blocks/products' }
47- ${ 'wc/blocks/products/attributes/(?P<attribute_id>[d]+)' } | ${ [ 'attribute_id' ] } | ${ 'wc/blocks/products/attributes/{attribute_id}' }
48- ${ 'wc/blocks/products/attributes/(?P<attribute_id>[d]+)/terms' } | ${ [ 'attribute_id' ] } | ${ 'wc/blocks/products/attributes/{attribute_id}/terms' }
49- ${ 'wc/blocks/products/attributes/(?P<attribute_id>[d]+)/terms/(?P<id>[d]+)' } | ${ [ 'attribute_id' , 'id' ] } | ${ 'wc/blocks/products/attributes/{attribute_id}/terms/{id}' }
50- ${ 'wc/blocks/products/attributes/(?P<attribute_id>[d]+)/terms/(?P<id>[d]+)' } | ${ [ 'id' , 'attribute_id' ] } | ${ 'wc/blocks/products/attributes/{attribute_id}/terms/{id}' }
51- ${ 'wc/blocks/cart/(?P<id>[s]+)' } | ${ [ 'id' ] } | ${ 'wc/blocks/cart/{id}' }
52- ${ 'wc/blocks/cart/(?P<id>[s]+)' } | ${ [ 'attribute_id' ] } | ${ 'wc/blocks/cart/(?P<id>[s]+)' }
45+ route | matchIds | expected
46+ ${ 'wc/blocks/products' } | ${ [ ] } | ${ 'wc/blocks/products' }
47+ ${ 'wc/blocks/products/attributes/(?P<attribute_id>[\\ d]+)' } | ${ [ 'attribute_id' ] } | ${ 'wc/blocks/products/attributes/{attribute_id}' }
48+ ${ 'wc/blocks/products/attributes/(?P<attribute_id>[\\ d]+)/terms' } | ${ [ 'attribute_id' ] } | ${ 'wc/blocks/products/attributes/{attribute_id}/terms' }
49+ ${ 'wc/blocks/products/attributes/(?P<attribute_id>[\\ d]+)/terms/(?P<id>[\\ d]+)' } | ${ [ 'attribute_id' , 'id' ] } | ${ 'wc/blocks/products/attributes/{attribute_id}/terms/{id}' }
50+ ${ 'wc/blocks/products/attributes/(?P<attribute_id>[\\ d]+)/terms/(?P<id>[\\ d]+)' } | ${ [ 'id' , 'attribute_id' ] } | ${ 'wc/blocks/products/attributes/{attribute_id}/terms/{id}' }
51+ ${ 'wc/blocks/cart/(?P<id>[\\ s]+)' } | ${ [ 'id' ] } | ${ 'wc/blocks/cart/{id}' }
52+ ${ 'wc/blocks/cart/(?P<id>[\\ s]+)' } | ${ [ 'attribute_id' ] } | ${ 'wc/blocks/cart/(?P<id>[\\ s]+)' }
5353 ` (
5454 'returns "$expected" when route is "$route" and matchIds is "$matchIds"' ,
5555 ( { route, matchIds, expected } ) => {
0 commit comments