Skip to content

Commit 4650dd2

Browse files
Merge pull request #34 from xanthous-tech/delete-all-fix
fix api and test
2 parents ff129f9 + a5b3cc6 commit 4650dd2

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@xanthous/dgraph-orm",
3-
"version": "0.3.2",
3+
"version": "0.3.3",
44
"description": "dgraph ORM in TypeScript",
55
"main": "dist/index.js",
66
"author": "Xanthous Tech Developers <[email protected]>",

src/transaction/predicate-impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export class PredicateImpl<T = any, U = any> implements IPredicate<T, U> {
9090
}
9191

9292
deleteAll(): IPredicate<T, U> {
93-
this.delete(this._data);
93+
this.delete(Array.from(this._data));
9494
return this;
9595
}
9696

tests/delete.spec.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ describe('Delete handling', function() {
2929
{
3030
uid: '0x3',
3131
'Person.name': 'Kamil'
32+
},
33+
{
34+
uid: '0x4',
35+
'Person.name': 'Adam'
3236
}
3337
]
3438
}
@@ -46,7 +50,7 @@ describe('Delete handling', function() {
4650
transaction.tree[0].friends.delete(jane);
4751

4852
// XXX: here kamil is not deleted in the friends predicate
49-
expect(transaction.tree[0].friends.get().length).toBe(1);
53+
expect(transaction.tree[0].friends.get().length).toBe(2);
5054

5155
expect(transaction.getDeleteNQuadsString()).toEqual(
5256
`<0x3> * * .
@@ -63,6 +67,8 @@ describe('Delete handling', function() {
6367
<0x2> * * .
6468
<0x1> <Person.friends> <0x2> .
6569
<0x1> <Person.friends> <0x3> .
70+
<0x4> * * .
71+
<0x1> <Person.friends> <0x4> .
6672
`
6773
);
6874
});

0 commit comments

Comments
 (0)