Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests] Change test_queries to list #1166 #1167

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading