|
| 1 | +import test from 'ava'; |
| 2 | +import themer from '../index.js'; |
| 3 | + |
| 4 | +test('zed', async (t) => { |
| 5 | + const files = []; |
| 6 | + for await (const file of themer(['default'], ['zed'], { |
| 7 | + wallpaperSizes: [], |
| 8 | + })) { |
| 9 | + files.push(file); |
| 10 | + } |
| 11 | + t.is(files.length, 2, 'produces a theme file and a README'); |
| 12 | + const theme = files.find(({ path }) => path.endsWith('.json')); |
| 13 | + t.truthy(theme, 'produces a JSON theme file'); |
| 14 | + const parsed = JSON.parse(theme?.content || ''); |
| 15 | + t.is(parsed.name, 'Themer Default', 'theme family has correct name'); |
| 16 | + t.is(parsed.author, 'Themer', 'theme has correct author'); |
| 17 | + t.truthy( |
| 18 | + Array.isArray(parsed.themes) && parsed.themes.length > 0, |
| 19 | + 'contains theme variants', |
| 20 | + ); |
| 21 | + for (const variant of parsed.themes) { |
| 22 | + t.truthy(variant.name, 'variant has a name'); |
| 23 | + t.regex( |
| 24 | + variant.appearance, |
| 25 | + /^(dark|light)$/, |
| 26 | + 'variant has valid appearance', |
| 27 | + ); |
| 28 | + t.truthy(variant.style, 'variant has style'); |
| 29 | + t.truthy(variant.style.syntax, 'variant has syntax highlighting'); |
| 30 | + t.truthy( |
| 31 | + Array.isArray(variant.style.players) && variant.style.players.length > 0, |
| 32 | + 'variant has player colors', |
| 33 | + ); |
| 34 | + } |
| 35 | +}); |
0 commit comments