Skip to content

Commit

Permalink
feat: test wrong propertyName
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsad committed Oct 16, 2023
1 parent 58911b5 commit 6a95687
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/JsonDB.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,21 @@ describe('JsonDB', () => {
'DataPath: /a/1 not found.'
)
})
test('should throw path error when not found item and using a wrong propertyName',() => {
db.getData = jest.fn(async () => ({
a: [
{
id: '1'
}
]
}))

expect(async () => {
await db.toPath('/a/1', '_id')
}).rejects.toThrow(
'DataPath: /a/1 not found.'
)
})
})

// Test was made for code coverage for getParentData, but this cannot return null or undefined.
Expand Down

0 comments on commit 6a95687

Please sign in to comment.