Files
product_inventory/test_output_2.txt
Ben Miller 243f7057b7 fix(media-manager): resolve video preview issues and stabilize tests
- Backend (MediaService):
    - Implemented robust contentUrl generation for Drive files using drive.google.com/uc pattern.
    - Added mimeType exposure to unified media state.

- Frontend (MediaManager):
    - Replaced video tag with iframe embedding the Google Drive Preview player (/preview) for reliable playback.
    - Fixed syntax error in console logging causing UI freeze.
    - Updated gallery card logic to prioritize video content URLs.

- Tests (Integration):
    - Refactored mediaManager.integration.test.ts to align with new logic.
    - Mocked DriveApp completely to support orphan adoption flows.
    - Updated file renaming expectations to support timestamped filenames.

- Documentation:
    - Updated MEMORY.md with video preview strategy.
2025-12-28 15:51:56 -07:00

132 lines
11 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.


> product_inventory@0.0.1 test
> jest src/mediaManager.integration.test.ts
console.log
MediaService: Getting unified state for SKU SKU-123
at MediaService.log [as getUnifiedMediaState] (src/services/MediaService.ts:69:13)
console.log
MediaService: Getting unified state for SKU SKU-123
at MediaService.log [as getUnifiedMediaState] (src/services/MediaService.ts:69:13)
console.log
MediaService: Getting unified state for SKU SKU-123
at MediaService.log [as getUnifiedMediaState] (src/services/MediaService.ts:69:13)
console.log
MediaService: Processing changes for SKU SKU-123
at MediaService.log [as processMediaChanges] (src/services/MediaService.ts:162:13)
console.log
MediaService: Processing changes for SKU SKU-123
at MediaService.log [as processMediaChanges] (src/services/MediaService.ts:162:13)
console.log
MediaService: Processing changes for SKU SKU-123
at MediaService.log [as processMediaChanges] (src/services/MediaService.ts:162:13)
console.log
Adopting Orphan: backfill.jpg
at log (src/services/MediaService.ts:200:21)
at Array.forEach (<anonymous>)
console.log
MediaService: Processing changes for SKU SKU-123
at MediaService.log [as processMediaChanges] (src/services/MediaService.ts:162:13)
console.log
Deleting item: delete_me.jpg
at log (src/services/MediaService.ts:182:17)
at Array.forEach (<anonymous>)
console.log
MediaService: Processing changes for SKU SKU-123
at MediaService.log [as processMediaChanges] (src/services/MediaService.ts:162:13)
node.exe : FAIL src/mediaManager.integration.test.ts
At C:\nvm4w\nodejs\npm.ps1:29 char:3
+ & $NODE_EXE $NPM_CLI_JS $args
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (FAIL src/mediaM...gration.test.ts:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
MediaService V2 Integration Logic
getUnifiedMediaState (Phase A)
√ should match Drive and Shopify items by ID (Strong Link) (31 ms)
√ should identify Drive-Only items (New Uploads) (1 ms)
√ should identify Shopify-Only items (1 ms)
processMediaChanges (Phase B)
√ should rename Drive files sequentially (2 ms)
× should call Shopify Reorder Mutation (2 ms)
× should backfill Shopify-Only items to Drive (1 ms)
√ should delete removed items (1 ms)
√ should upload Drive-Only items (1 ms)
● MediaService V2 Integration Logic › processMediaChanges (Phase B) › should call Shopify Reorder
Mutation
expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: "gid://shopify/Product/123", [{"id": "s10", "newPosition": "0"}, {"id": "s20", "newPosition":
"1"}]
Number of calls: 0
  173 | service.processMediaChanges("SKU-123",
finalState, dummyPid)
 174 |
> 175 |
expect(mockShopify.productReorderMedia).toHaveBeenCalledWith(dummyPid, [
 | ^
 176 | { id: "s10", newPosition:
"0" },
 177 | { id: "s20", newPosition:
"1" }
 178 | ])
at Object.<anonymous> (src/mediaManager.integration.test.ts:175:53)
● MediaService V2 Integration Logic › processMediaChanges (Phase B) › should backfill Shopify-Only
items to Drive
expect(jest.fn()).toHaveBeenCalled()
Expected number of calls: >= 1
Received number of calls: 0
  192 | service.processMediaChanges("SKU-123",
finalState, dummyPid)
 193 |
> 194 |
expect(mockDrive.createFile).toHaveBeenCalled()
 | ^
 195 | expect(mockDrive.updateFileProperties).toHaveBeenCalledWit
h("new_created_file_id", { shopify_media_id: "s99" })
 196 | })
 197 |
at Object.<anonymous> (src/mediaManager.integration.test.ts:194:42)
-----------------|---------|----------|---------|---------|-----------------------------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-----------------|---------|----------|---------|---------|-----------------------------------------
All files | 74.69 | 72.34 | 85 | 74.83 |
MediaService.ts | 74.69 | 72.34 | 85 | 74.83 | 28-65,95-98,105-108,207-226,280-281,330
-----------------|---------|----------|---------|---------|-----------------------------------------
Test Suites: 1 failed, 1 total
Tests: 2 failed, 6 passed, 8 total
Snapshots: 0 total
Time: 1.354 s, estimated 3 s
Ran all test suites matching /src\\mediaManager.integration.test.ts/i.