* Helper: parse an OBJ string synchronously by feeding it to the parser internals. * We bypass the fetch/preload and call parseOBJ directly via a dynamic import.
(text)
| 305 | * We bypass the fetch/preload and call parseOBJ directly via a dynamic import. |
| 306 | */ |
| 307 | async function parseOBJString(text) { |
| 308 | // The parseOBJ function is not exported, so we test via preloadOBJ indirectly |
| 309 | // or we can import the module and access it. For now, test via the cache. |
| 310 | // We'll use a data URL approach with the preload function. |
| 311 | const name = "test_" + Math.random(); |
| 312 | const blob = new Blob([text], { type: "text/plain" }); |
| 313 | const url = URL.createObjectURL(blob); |
| 314 | |
| 315 | return new Promise((resolve, reject) => { |
| 316 | preloadOBJ( |
| 317 | { name, src: url }, |
| 318 | () => { |
| 319 | URL.revokeObjectURL(url); |
| 320 | resolve(objList[name]); |
| 321 | }, |
| 322 | (err) => { |
| 323 | URL.revokeObjectURL(url); |
| 324 | reject(err); |
| 325 | }, |
| 326 | {}, |
| 327 | ); |
| 328 | }); |
| 329 | } |
| 330 | |
| 331 | describe("OBJ Parser", () => { |
| 332 | it("parses vertices and faces", async () => { |
no test coverage detected