Skip to content

Commit

Permalink
step 9 test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sudarshan-21 committed May 15, 2024
1 parent 696b44f commit eb13016
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/queryParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function parseQuery(query) {
fields: fields.split(",").map((field) => field.trim()),
table: table.trim(),
whereClauses,
joinType,
joinTable,
joinCondition,
};
Expand Down
1 change: 1 addition & 0 deletions tests/step-03/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ test("Parse SQL Query", () => {
fields: ["id", "name"],
table: "student",
whereClauses: [],
joinType: null,
joinCondition: null,
joinTable: null,
});
Expand Down
1 change: 1 addition & 0 deletions tests/step-04/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ test("Parse SQL Query", () => {
fields: ["id", "name"],
table: "student",
whereClauses: [],
joinType: null,
joinCondition: null,
joinTable: null,
});
Expand Down
2 changes: 2 additions & 0 deletions tests/step-05/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ test("Parse SQL Query", () => {
fields: ["id", "name"],
table: "student",
whereClauses: [],
joinType: null,
joinCondition: null,
joinTable: null,
});
Expand Down Expand Up @@ -45,6 +46,7 @@ test("Parse SQL Query with WHERE Clause", () => {
value: "25",
},
],
joinType: null,
joinCondition: null,
joinTable: null,
});
Expand Down
3 changes: 3 additions & 0 deletions tests/step-06/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ test("Parse SQL Query", () => {
fields: ["id", "name"],
table: "student",
whereClauses: [],
joinType: null,
joinCondition: null,
joinTable: null,
});
Expand Down Expand Up @@ -45,6 +46,7 @@ test("Parse SQL Query with WHERE Clause", () => {
value: "25",
},
],
joinType: null,
joinCondition: null,
joinTable: null,
});
Expand Down Expand Up @@ -77,6 +79,7 @@ test("Parse SQL Query with Multiple WHERE Clauses", () => {
value: "John",
},
],
joinType: null,
joinCondition: null,
joinTable: null,
});
Expand Down
3 changes: 3 additions & 0 deletions tests/step-07/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ test("Parse SQL Query", () => {
fields: ["id", "name"],
table: "student",
whereClauses: [],
joinType: null,
joinCondition: null,
joinTable: null,
});
Expand Down Expand Up @@ -45,6 +46,7 @@ test("Parse SQL Query with WHERE Clause", () => {
value: "25",
},
],
joinType: null,
joinCondition: null,
joinTable: null,
});
Expand Down Expand Up @@ -77,6 +79,7 @@ test("Parse SQL Query with Multiple WHERE Clauses", () => {
value: "John",
},
],
joinType: null,
joinCondition: null,
joinTable: null,
});
Expand Down
5 changes: 5 additions & 0 deletions tests/step-08/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ test("Parse SQL Query", () => {
fields: ["id", "name"],
table: "student",
whereClauses: [],
joinType: null,
joinCondition: null,
joinTable: null,
});
Expand Down Expand Up @@ -45,6 +46,7 @@ test("Parse SQL Query with WHERE Clause", () => {
value: "25",
},
],
joinType: null,
joinCondition: null,
joinTable: null,
});
Expand Down Expand Up @@ -77,6 +79,7 @@ test("Parse SQL Query with Multiple WHERE Clauses", () => {
value: "John",
},
],
joinType: null,
joinCondition: null,
joinTable: null,
});
Expand Down Expand Up @@ -111,6 +114,7 @@ test("Parse SQL Query with INNER JOIN", async () => {
fields: ["student.name", "enrollment.course"],
table: "student",
whereClauses: [],
joinType: null,
joinTable: "enrollment",
joinCondition: { left: "student.id", right: "enrollment.student_id" },
});
Expand All @@ -124,6 +128,7 @@ test("Parse SQL Query with INNER JOIN and WHERE Clause", async () => {
fields: ["student.name", "enrollment.course"],
table: "student",
whereClauses: [{ field: "student.age", operator: ">", value: "20" }],
joinType: null,
joinTable: "enrollment",
joinCondition: { left: "student.id", right: "enrollment.student_id" },
});
Expand Down

0 comments on commit eb13016

Please sign in to comment.