File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -421,7 +421,7 @@ export class JsonDB {
421
421
* @param path router based path to a correct base path
422
422
* @param propertyName name of the property to look for searchValue
423
423
*/
424
- public async toPath ( path : string , propertyName :string = 'id' ) : Promise < string > {
424
+ public async fromPath ( path : string , propertyName :string = 'id' ) : Promise < string > {
425
425
426
426
const [ , ...pathToQuery ] = path . split ( "/" )
427
427
Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ describe('Array Utils', () => {
249
249
250
250
const routerPathStyle = '/recipes/65464646155/nested/88488'
251
251
252
- const normalPath = await db . toPath ( routerPathStyle )
252
+ const normalPath = await db . fromPath ( routerPathStyle )
253
253
254
254
expect ( normalPath ) . toEqual ( '/recipes[1]/nested[1]' )
255
255
} )
@@ -289,7 +289,7 @@ describe('Array Utils', () => {
289
289
290
290
const routerPathStyle = '/recipes/65464646155/nested/88488'
291
291
292
- const normalPath = await db . toPath ( routerPathStyle , '_id' )
292
+ const normalPath = await db . fromPath ( routerPathStyle , '_id' )
293
293
294
294
expect ( normalPath ) . toEqual ( '/recipes[1]/nested[1]' )
295
295
} )
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ describe('JsonDB', () => {
96
96
} )
97
97
} )
98
98
99
- describe ( 'toPath ()' , ( ) => {
99
+ describe ( 'fromPath ()' , ( ) => {
100
100
test ( 'should throw path error when not found item' , ( ) => {
101
101
db . getData = jest . fn ( async ( ) => ( {
102
102
a : [
@@ -107,7 +107,7 @@ describe('JsonDB', () => {
107
107
} ) )
108
108
109
109
expect ( async ( ) => {
110
- await db . toPath ( '/a/1' )
110
+ await db . fromPath ( '/a/1' )
111
111
} ) . rejects . toThrow (
112
112
'DataPath: /a/1 not found.'
113
113
)
@@ -122,7 +122,7 @@ describe('JsonDB', () => {
122
122
} ) )
123
123
124
124
expect ( async ( ) => {
125
- await db . toPath ( '/a/1' , '_id' )
125
+ await db . fromPath ( '/a/1' , '_id' )
126
126
} ) . rejects . toThrow (
127
127
'DataPath: /a/1 not found.'
128
128
)
You can’t perform that action at this time.
0 commit comments