|
| 1 | +//(Please avoid LLM spam) |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +// Test for Issue #3447: Add "default" option for thumbnails per row |
| 8 | + |
| 9 | +// Read the general.js skeleton to verify the default option exists |
| 10 | +const fs = require('fs'); |
| 11 | +const path = require('path'); |
| 12 | + |
| 13 | +describe('Thumbnails per Row Configuration', () => { |
| 14 | + let generalSkeletonContent; |
| 15 | + |
| 16 | + beforeAll(() => { |
| 17 | + const skeletonPath = path.join(__dirname, '../../menu/skeleton-parts/general.js'); |
| 18 | + generalSkeletonContent = fs.readFileSync(skeletonPath, 'utf8'); |
| 19 | + }); |
| 20 | + |
| 21 | + test('change_thumbnails_per_row should have a default option', () => { |
| 22 | + // Check that the skeleton contains the default option |
| 23 | + expect(generalSkeletonContent).toContain("text: 'default'"); |
| 24 | + expect(generalSkeletonContent).toContain("value: 'default'"); |
| 25 | + }); |
| 26 | + |
| 27 | + test('default option should be first in the options list', () => { |
| 28 | + // The default option should appear before the '4' option in the file |
| 29 | + const defaultIndex = generalSkeletonContent.indexOf("text: 'default'"); |
| 30 | + const fourIndex = generalSkeletonContent.indexOf("text: '4'"); |
| 31 | + |
| 32 | + expect(defaultIndex).toBeLessThan(fourIndex); |
| 33 | + expect(defaultIndex).toBeGreaterThan(-1); |
| 34 | + }); |
| 35 | +}); |
| 36 | + |
| 37 | +describe('changeThumbnailsPerRow function', () => { |
| 38 | + let generalJsContent; |
| 39 | + |
| 40 | + beforeAll(() => { |
| 41 | + const generalJsPath = path.join(__dirname, '../../js&css/extension/www.youtube.com/general/general.js'); |
| 42 | + generalJsContent = fs.readFileSync(generalJsPath, 'utf8'); |
| 43 | + }); |
| 44 | + |
| 45 | + test('should handle default value by returning early', () => { |
| 46 | + // Check that the function returns early when value is 'default' |
| 47 | + expect(generalJsContent).toContain("value === 'default'"); |
| 48 | + }); |
| 49 | +}); |
0 commit comments