`import Axios from "axios"` -- the default-import binding capitalized, a * common convention -- must classify `Axios.get/post/delete(url)` as HTTP * client calls exactly like `axios.*`. The library table matched only the * lowercase id, so the calls fell through to the `.get`/`.post` route-suffix * fallback and became route REGISTRATIONS: on * microsoft/Game-Control-Puzzle-Event-Administratio
| 9889 | * project stays a registration. `fillers` > 0 forces the parallel resolver, |
| 9890 | * 0 keeps the sequential one; both classify through the same table. */ |
| 9891 | static int capitalized_axios_case(int fillers) { |
| 9892 | char tmp[256]; |
| 9893 | snprintf(tmp, sizeof(tmp), "/tmp/cbm_axios_cap_XXXXXX"); |
| 9894 | if (!cbm_mkdtemp(tmp)) { |
| 9895 | FAIL("tmpdir"); |
| 9896 | } |
| 9897 | |
| 9898 | write_temp_file(tmp, "src/service.ts", |
| 9899 | "import Axios from \"axios\";\n" |
| 9900 | "export function getSettings(eventId: string) {\n" |
| 9901 | " return Axios.get(`/api/admin/events/${eventId}/settings`);\n" |
| 9902 | "}\n" |
| 9903 | "export function addUser(eventId: string, participant: unknown) {\n" |
| 9904 | " return Axios.post(`/api/admin/users/${eventId}`, participant);\n" |
| 9905 | "}\n" |
| 9906 | "export function removeUser(id: string) {\n" |
| 9907 | " return Axios.delete(`/api/admin/users/${id}`);\n" |
| 9908 | "}\n"); |
| 9909 | write_temp_file(tmp, "src/server.ts", |
| 9910 | "function listUsers(req: unknown, res: unknown) {}\n" |
| 9911 | "export function mount(router: any) {\n" |
| 9912 | " router.get('/api/admin/users', listUsers);\n" |
| 9913 | "}\n"); |
| 9914 | for (int i = 0; i < fillers; i++) { |
| 9915 | char name[64]; |
| 9916 | char body[128]; |
| 9917 | snprintf(name, sizeof(name), "src/filler%d.ts", i); |
| 9918 | snprintf(body, sizeof(body), "export function filler%d(): number {\n return %d;\n}\n", i, |
| 9919 | i); |
| 9920 | write_temp_file(tmp, name, body); |
| 9921 | } |
| 9922 | |
| 9923 | char *old_workers = getenv("CBM_WORKERS"); |
| 9924 | char *saved = old_workers ? strdup(old_workers) : NULL; |
| 9925 | cbm_setenv("CBM_WORKERS", "4", 1); |
| 9926 | |
| 9927 | char db_path[512]; |
| 9928 | snprintf(db_path, sizeof(db_path), "%s/axios_cap.db", tmp); |
| 9929 | cbm_pipeline_t *p = cbm_pipeline_new(tmp, db_path, CBM_MODE_FULL); |
| 9930 | ASSERT_NOT_NULL(p); |
| 9931 | ASSERT_EQ(cbm_pipeline_run(p), 0); |
| 9932 | const char *project = cbm_pipeline_project_name(p); |
| 9933 | |
| 9934 | cbm_store_t *s = cbm_store_open_path(db_path); |
| 9935 | ASSERT_NOT_NULL(s); |
| 9936 | |
| 9937 | static const struct { |
| 9938 | const char *caller; |
| 9939 | const char *typed_route; |
| 9940 | } client[] = {{"getSettings", "__route__GET__"}, |
| 9941 | {"addUser", "__route__POST__"}, |
| 9942 | {"removeUser", "__route__DELETE__"}}; |
| 9943 | for (size_t i = 0; i < sizeof(client) / sizeof(client[0]); i++) { |
| 9944 | ASSERT_EQ(route_registrations_from(s, project, client[i].caller), 0); |
| 9945 | ASSERT_EQ(http_calls_to_route(s, project, client[i].caller, client[i].typed_route), 1); |
| 9946 | } |
| 9947 | /* Control: the server-side registration is untouched. */ |
| 9948 | ASSERT_EQ(route_registrations_from(s, project, "mount"), 1); |
no test coverage detected