Skip to content

Commit

Permalink
[tests] Change test_queries to list #1166 (#1167)
Browse files Browse the repository at this point in the history
update test org
  • Loading branch information
michaelvlach authored Jul 29, 2024
1 parent b93dcbc commit 105a6e3
Show file tree
Hide file tree
Showing 4 changed files with 3,158 additions and 2,965 deletions.
7 changes: 4 additions & 3 deletions agdb_api/typescript/query_test_generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ class T { db_id: undefined = undefined; value1: string = ""; value2: number = 0;
\n\n
describe("query tests", () => {`;

for (let query in test_queries) {
let builder = query;
for (let index in test_queries) {
let name = test_queries[index][0];
let builder = test_queries[index][0];
builder = builder.replace(/&/g, "");
builder = builder.replace(/T::default\(\)/g, "new T()");
builder = builder.replace(/::/g, ".");
Expand All @@ -25,7 +26,7 @@ for (let query in test_queries) {
builder = builder.replace(/\("k",2\)/g, "[\"k\", 2]");
builder = builder.replace(/\(1,10\)/g, "[1, 10]");

tests += `it(\`${query}\`, () => { let query = \`${query}\`;\nlet builder = ${builder};\nexpect(builder).toEqual(test_queries[query]); });\n\n`;
tests += `it(\`${name}\`, () => { let query = ${builder};\nexpect(query).toEqual(test_queries[${index}][1]); });\n\n`;
}

tests += `});`;
Expand Down
Loading

0 comments on commit 105a6e3

Please sign in to comment.