- 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.
132 lines
11 KiB
Plaintext
132 lines
11 KiB
Plaintext
|
||
> 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
|
||
|
||
[0m [90m 173 |[39m service[33m.[39mprocessMediaChanges([32m"SKU-123"[39m[33m,[39m
|
||
finalState[33m,[39m dummyPid)
|
||
[90m 174 |[39m
|
||
[31m[1m>[22m[39m[90m 175 |[39m
|
||
expect(mockShopify[33m.[39mproductReorderMedia)[33m.[39mtoHaveBeenCalledWith(dummyPid[33m,[39m [
|
||
[90m |[39m [31m[1m^[22m[39m
|
||
[90m 176 |[39m { id[33m:[39m [32m"s10"[39m[33m,[39m newPosition[33m:[39m
|
||
[32m"0"[39m }[33m,[39m
|
||
[90m 177 |[39m { id[33m:[39m [32m"s20"[39m[33m,[39m newPosition[33m:[39m
|
||
[32m"1"[39m }
|
||
[90m 178 |[39m ])[0m
|
||
|
||
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
|
||
|
||
[0m [90m 192 |[39m service[33m.[39mprocessMediaChanges([32m"SKU-123"[39m[33m,[39m
|
||
finalState[33m,[39m dummyPid)
|
||
[90m 193 |[39m
|
||
[31m[1m>[22m[39m[90m 194 |[39m
|
||
expect(mockDrive[33m.[39mcreateFile)[33m.[39mtoHaveBeenCalled()
|
||
[90m |[39m [31m[1m^[22m[39m
|
||
[90m 195 |[39m expect(mockDrive[33m.[39mupdateFileProperties)[33m.[39mtoHaveBeenCalledWit
|
||
h([32m"new_created_file_id"[39m[33m,[39m { shopify_media_id[33m:[39m [32m"s99"[39m })
|
||
[90m 196 |[39m })
|
||
[90m 197 |[39m[0m
|
||
|
||
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.
|