Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mmastrac committed Nov 13, 2024
1 parent eb96394 commit 49aad45
Show file tree
Hide file tree
Showing 26 changed files with 46 additions and 33 deletions.
2 changes: 1 addition & 1 deletion tests/basic/env.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -390,4 +390,4 @@
"name": "test_31",
"result": {}
}
]
]
2 changes: 1 addition & 1 deletion tests/basic/fs.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,4 @@
"user": "test3n"
}
}
]
]
2 changes: 1 addition & 1 deletion tests/basic/opts.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -562,4 +562,4 @@
}
}
}
]
]
2 changes: 1 addition & 1 deletion tests/error/credentials_file_not_found.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
"instance": "test_instance"
}
}
]
]
2 changes: 1 addition & 1 deletion tests/error/env_not_found.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
"dsn": "edgedb://testuser@localhost/db?secret_key_env=EDGEDB_SECRET_KEY"
}
}
]
]
2 changes: 1 addition & 1 deletion tests/error/exclusive_options.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@
"port": 1312
}
}
]
]
2 changes: 1 addition & 1 deletion tests/error/file_not_found.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
"dsn": "edgedb://testuser@localhost/db?secret_key_file=/home/edgedb/secret_key"
}
}
]
]
2 changes: 1 addition & 1 deletion tests/error/invalid_credentials_file.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,4 @@
"instance": "test_instance"
}
}
]
]
2 changes: 1 addition & 1 deletion tests/error/invalid_database.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
"dsn": "edgedb://?database"
}
}
]
]
2 changes: 1 addition & 1 deletion tests/error/invalid_dsn.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@
"dsn": "edgedb://testuser:pass@localhost/db?password_env=EDGEDB_PASSWORD"
}
}
]
]
2 changes: 1 addition & 1 deletion tests/error/invalid_dsn_or_instance_name.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@
"instance": "test/te--st"
}
}
]
]
2 changes: 1 addition & 1 deletion tests/error/invalid_host.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@
"dsn": "edgedb://?host="
}
}
]
]
2 changes: 1 addition & 1 deletion tests/error/invalid_instance_name.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
"instance": "12345678901234567890123456789012/34567890123456789012345678901234"
}
}
]
]
2 changes: 1 addition & 1 deletion tests/error/invalid_port.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@
"port": "1111,2222"
}
}
]
]
2 changes: 1 addition & 1 deletion tests/error/invalid_secret_key.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"instance": "test-org/test-123"
}
}
]
]
2 changes: 1 addition & 1 deletion tests/error/invalid_tls_security.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@
"dsn": "edgedb://?tls_security"
}
}
]
]
2 changes: 1 addition & 1 deletion tests/error/invalid_user.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
"dsn": "edgedb://?user="
}
}
]
]
2 changes: 1 addition & 1 deletion tests/error/multiple_compound_env.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,4 @@
},
"name": "test_12"
}
]
]
2 changes: 1 addition & 1 deletion tests/error/multiple_compound_opts.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@
"credentialsFile": "/home/edgedb/test/credentials.json"
}
}
]
]
2 changes: 1 addition & 1 deletion tests/error/no_options_or_toml.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
"docker_tcp_port"
]
}
]
]
2 changes: 1 addition & 1 deletion tests/error/project_not_initialised.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
},
"name": "test_0"
}
]
]
2 changes: 1 addition & 1 deletion tests/error/secret_key_not_found.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
"instance": "testorg/test-123"
}
}
]
]
2 changes: 1 addition & 1 deletion tests/error/unix_socket_unsupported.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
"dsn": "edgedb:///dbname?host=/unix_sock/test&user=spam"
}
}
]
]
2 changes: 1 addition & 1 deletion tests/override/certificate.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,4 @@
"tlsSecurity": "no_host_verification"
}
}
]
]
2 changes: 1 addition & 1 deletion tests/override/other.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -1628,4 +1628,4 @@
"user": "testuser"
}
}
]
]
29 changes: 21 additions & 8 deletions tools/rebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { jsonc } from "npm:jsonc";
const DEFAULT_RESULT = {
"address": [
"localhost",
5656
5656,
],
"branch": "__default__",
"database": "edgedb",
Expand All @@ -21,7 +21,7 @@ const DEFAULT_RESULT = {
"tlsSecurity": "strict",
"tlsServerName": null,
"user": "edgedb",
"waitUntilAvailable": "PT30S"
"waitUntilAvailable": "PT30S",
};

function collectRecursively(base: string, path: string): string[] {
Expand Down Expand Up @@ -75,26 +75,39 @@ for (const path of collectRecursively(tests, "")) {
if (!(resultKey in DEFAULT_RESULT)) {
throw new Error(`Invalid result key ${resultKey} in ${path}`);
}
if (JSON.stringify(DEFAULT_RESULT[resultKey]) === JSON.stringify(testcase.result[resultKey])) {
console.warn(`Removing default value ${DEFAULT_RESULT[resultKey]} from result key ${resultKey} in ${path} for testcase ${testcase.name}`);
if (
JSON.stringify(DEFAULT_RESULT[resultKey]) ===
JSON.stringify(testcase.result[resultKey])
) {
console.warn(
`Removing default value ${
DEFAULT_RESULT[resultKey]
} from result key ${resultKey} in ${path} for testcase ${testcase.name}`,
);
delete testcase.result[resultKey];
dirty = true;
}
}
}
}
if (testcase.env && Object.keys(testcase.env).length === 0) {
console.warn(`Removing empty env object from ${path} for testcase ${testcase.name}`);
console.warn(
`Removing empty env object from ${path} for testcase ${testcase.name}`,
);
delete testcase.env;
dirty = true;
}
if (testcase.fs && Object.keys(testcase.fs).length === 0) {
console.warn(`Removing empty fs object from ${path} for testcase ${testcase.name}`);
console.warn(
`Removing empty fs object from ${path} for testcase ${testcase.name}`,
);
delete testcase.fs;
dirty = true;
}
if (testcase.opts && Object.keys(testcase.opts).length === 0) {
console.warn(`Removing empty opts object from ${path} for testcase ${testcase.name}`);
console.warn(
`Removing empty opts object from ${path} for testcase ${testcase.name}`,
);
delete testcase.opts;
dirty = true;
}
Expand All @@ -108,7 +121,7 @@ for (const path of collectRecursively(tests, "")) {
}

outTestCase.name = path.replace("/", "_").replace(".jsonc", "") + "_" +
outTestCase.name;
outTestCase.name;
out.push(outTestCase);
}

Expand Down

0 comments on commit 49aad45

Please sign in to comment.