wayBetter for X 1.0.2

This commit is contained in:
CRTkafa 2026-10-02 02:54:04 +07:00
parent 785c8cc72c
commit 435f05bd3e
212 changed files with 10208 additions and 2345 deletions

View file

@ -0,0 +1,26 @@
// The Store's item kinds as the site knows them: icon packs get pages like any file item, built-in
// items (area plugins) are not pages of the catalog (the site has its own area pages), and an
// "Install in wayBetter" link for an icon pack is a plain install link the app parses.
import { describe, expect, test } from 'bun:test';
import { KIND_FOLDER, KIND_LABEL, itemPath, itemSlugs, type StoreItem } from '../seo.ts';
import { installLink } from '../store-pages.ts';
const pack: StoreItem = {
apps: ['x'], kind: 'icons', id: 'line-2', name: 'Line 2', author: 'me', version: '1.0.0', description: 'Thin lines.', category: 'icons', tags: [],
url: 'https://waybetter.fyi/store/icons/line-2.icons.json', sha256: 'a'.repeat(64), size: 900, license: 'CC0-1.0',
};
describe('item kinds', () => {
test('an icon pack has a folder, a label, a page path and an install link', () => {
expect(KIND_FOLDER.icons).toBe('icons');
expect(KIND_LABEL.icons).toBe('Icon pack');
expect(itemPath(pack, itemSlugs([pack]).get(pack)!)).toBe('/store/icons/line-2/');
expect(installLink(pack)).toBe('waybetter://install?kind=icons&url=https%3A%2F%2Fwaybetter.fyi%2Fstore%2Ficons%2Fline-2.icons.json');
});
test('the same id may be a theme and an icon pack: pages stay apart', () => {
const theme: StoreItem = { ...pack, kind: 'theme', url: 'https://waybetter.fyi/store/themes/line-2.json' };
const slugs = itemSlugs([pack, theme]);
expect([itemPath(pack, slugs.get(pack)!), itemPath(theme, slugs.get(theme)!)]).toEqual(['/store/icons/line-2/', '/store/themes/line-2/']);
});
});