From 6dc448d5edc89822e1d86d87bdccbf7904fc79f2 Mon Sep 17 00:00:00 2001 From: jelveh Date: Thu, 30 Jul 2026 12:57:46 -0700 Subject: [PATCH] Update apps tests for extension canonicalization Adjust apps API tests to match current normalization behavior for `filetypeAssociations`: extension values are stored as lowercase bare extensions (e.g. `.txt` -> `txt`), while MIME types remain unchanged. Added inline comments in both test suites to document this expected remap. --- src/puter-js/test/apps.test.js | 4 +++- src/puter-js/tests/api/suites/apps.suite.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/puter-js/test/apps.test.js b/src/puter-js/test/apps.test.js index 5846e4d75..6ab20ef2d 100644 --- a/src/puter-js/test/apps.test.js +++ b/src/puter-js/test/apps.test.js @@ -37,7 +37,9 @@ window.appsTests = [ }); const fetched = await puter.apps.get(name); assert(Boolean(fetched.maximize_on_start) === true, "maximize_on_start not stored"); - assert(JSON.stringify(fetched.filetype_associations) === JSON.stringify(['.txt', 'image/png']), "filetype_associations not stored"); + // Extensions are canonicalized to the bare lowercase form on + // write ('.txt' → 'txt'); MIME types pass through unchanged. + assert(JSON.stringify(fetched.filetype_associations) === JSON.stringify(['txt', 'image/png']), "filetype_associations not stored"); pass("testCreateOptionsRemap passed"); } catch (error) { fail("testCreateOptionsRemap failed:", error); diff --git a/src/puter-js/tests/api/suites/apps.suite.ts b/src/puter-js/tests/api/suites/apps.suite.ts index 8d9c55ed2..ea01e30fd 100644 --- a/src/puter-js/tests/api/suites/apps.suite.ts +++ b/src/puter-js/tests/api/suites/apps.suite.ts @@ -222,7 +222,9 @@ export default suite('apps', { maximizeOnStart: true, }); const fetched = await t.puter.apps.get('apps-suite-remap'); - t.assert.deepEqual(fetched.filetype_associations, ['.txt', 'image/png']); + // Extensions are canonicalized to the bare lowercase form on write + // ('.txt' → 'txt'); MIME-type associations pass through unchanged. + t.assert.deepEqual(fetched.filetype_associations, ['txt', 'image/png']); t.assert.equal(Boolean(fetched.maximize_on_start), true); }, });