Skip to content
This repository was archived by the owner on Jan 19, 2024. It is now read-only.

Commit 444f342

Browse files
committed
fix: general fixes and cleanups
1 parent efe6af4 commit 444f342

File tree

5 files changed

+65
-328
lines changed

5 files changed

+65
-328
lines changed

src/client.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ query myQuery($age: Int) {
5757
client.setTransport(mt);
5858
let msgs: IRGQLServerMessage[] = [
5959
{mutateValue: {valueNodeId: 1, queryNodeId: 1, isArray: true}},
60-
{mutateValue: {valueNodeId: 4, queryNodeId: 1, parentValueNodeId: 1}},
60+
{mutateValue: {valueNodeId: 4, queryNodeId: 1, parentValueNodeId: 1, arrayIdx: 1}},
6161
{
6262
mutateValue: {
6363
valueNodeId: 5,

src/query-tree/query-tree.spec.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,27 @@ describe('QueryTreeNode', () => {
126126
let res = tree.children[0].children[0].fullPathPlain;
127127
expect(res).toEqual(['allPeople', 'name']);
128128
});
129+
130+
it('should detect differing arguments', () => {
131+
let ast = parse(
132+
`
133+
query myQuery {
134+
field(arg1: "Test") {
135+
subfield
136+
}
137+
}
138+
query mySecondQuery {
139+
field(arg1: "Test Two") {
140+
subfield
141+
}
142+
}
143+
`,
144+
);
145+
let node = new QueryTreeNode();
146+
let sel1 = (<any>ast.definitions[0]);
147+
let sel2 = (<any>ast.definitions[1]);
148+
let q1 = node.buildQuery(sel1, {});
149+
let q2 = node.buildQuery(sel2, {});
150+
expect(node.children.length).toBe(2);
151+
});
129152
});

src/query.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ describe('ObservableQuery', () => {
5151
// However, due to debouncing we won't see the entire thing on the output without delays.
5252
let mutations: IRGQLValueMutation[] = [
5353
{valueNodeId: 1, queryNodeId: 1, isArray: true},
54-
{valueNodeId: 4, parentValueNodeId: 1, queryNodeId: 1},
54+
{valueNodeId: 4, parentValueNodeId: 1, queryNodeId: 1, arrayIdx: 1},
5555
{valueNodeId: 5, parentValueNodeId: 4, queryNodeId: 2, valueJson: '"John"', hasValue: true},
56-
{valueNodeId: 2, parentValueNodeId: 1, queryNodeId: 1},
56+
{valueNodeId: 2, parentValueNodeId: 1, queryNodeId: 1, arrayIdx: 2},
5757
{valueNodeId: 6, parentValueNodeId: 2, queryNodeId: 2, valueJson: '"Jane"', hasValue: true},
58-
{valueNodeId: 3, parentValueNodeId: 1, queryNodeId: 1},
58+
{valueNodeId: 3, parentValueNodeId: 1, queryNodeId: 1, arrayIdx: 3},
5959
{valueNodeId: 7, parentValueNodeId: 3, queryNodeId: 2, valueJson: '"Bill"', hasValue: true},
6060
{valueNodeId: 5, parentValueNodeId: 4, queryNodeId: 2, operation: 2},
6161
{valueNodeId: 4, parentValueNodeId: 1, queryNodeId: 1, operation: 2},

src/sort/binary-insertion.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ describe('binary-insertion', () => {
1717
it('should return 1 for 4.5 -> [4, 5, 6, 7]', () => {
1818
expect(binarySearch([4, 5, 6, 7], 4.5)).toBe(1);
1919
});
20-
fit('should splice 3 into [0, 1, 4, 5]', () => {
20+
it('should splice 3 into [0, 1, 4, 5]', () => {
2121
let arr = [0, 1, 4, 5];
2222
let idx = binarySearch(arr, 3) + 1;
2323
arr.splice(idx, 0, 3);
2424
expect(arr).toEqual([0, 1, 3, 4, 5]);
2525
});
26-
fit('should splice 3 into []', () => {
26+
it('should splice 3 into []', () => {
2727
let arr: number[] = [];
2828
let idx = insertionIndex(arr, 3);
2929
arr.splice(idx, 0, 3);
3030
expect(arr).toEqual([3]);
3131
});
32-
fit('should splice 3 into [5]', () => {
32+
it('should splice 3 into [5]', () => {
3333
let arr: number[] = [5];
3434
let idx = insertionIndex(arr, 3);
3535
arr.splice(idx, 0, 3);

0 commit comments

Comments
 (0)