mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(directory): load per-directory list files (#1134)
Merge board directories from the new bitsocialnet/lists per-directory layout on the client side. Update vendored fallback data, sync tooling, directory references, and tests. Treat failed board stat fetches as complete on the home page so stats do not stay loading forever.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { normalizeDirectoryList, sortDirectoryBoardsByRank } from '../directory-list-utils';
|
||||
|
||||
describe('directory-list-utils', () => {
|
||||
it('preserves board scores and uses them for ranking', () => {
|
||||
const list = normalizeDirectoryList(
|
||||
{
|
||||
directoryCode: 'biz',
|
||||
boards: [
|
||||
{ address: 'lower-score.bso', score: 1, addedAt: 1 },
|
||||
{ address: 'higher-score.bso', score: 10, addedAt: 2 },
|
||||
],
|
||||
},
|
||||
'biz',
|
||||
);
|
||||
|
||||
expect(list?.boards).toEqual([
|
||||
{ address: 'lower-score.bso', score: 1, addedAt: 1 },
|
||||
{ address: 'higher-score.bso', score: 10, addedAt: 2 },
|
||||
]);
|
||||
expect(sortDirectoryBoardsByRank(list?.boards ?? [])[0]?.address).toBe('higher-score.bso');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user