We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7a94172 commit 6a8ee73Copy full SHA for 6a8ee73
test/04-array-utils.test.ts
@@ -47,6 +47,18 @@ describe('Array Utils', () => {
47
expect(db.getIndex("/recipes", "78687873783", "test")).toBe(1);
48
expect(db.getIndex("/recipes", "12335373873", "test")).toBe(2);
49
})
50
+ test('should get the index of the current value with anything but numerical', () => {
51
+ const recipe_1 = {test: 65464646155, name: "Cheesecake", category: "Dessert"};
52
+ const recipe_2 = {test: 78687873783, name: "Gratin", category: "Dish"};
53
+ const recipe_3 = {test: 12335373873, name: "Soupe", category: "Starter"};
54
+ db.push("/recipes[0]", recipe_1, true);
55
+ db.push("/recipes[1]", recipe_2, true);
56
+ db.push("/recipes[2]", recipe_3, true);
57
+
58
+ expect(db.getIndex("/recipes", 65464646155, "test")).toBe(0);
59
+ expect(db.getIndex("/recipes", 78687873783, "test")).toBe(1);
60
+ expect(db.getIndex("/recipes", 12335373873, "test")).toBe(2);
61
+ })
62
63
64
describe('Cleanup', () => {
0 commit comments