mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
test: nodeInfoCache fetch
This commit is contained in:
parent
b3ef9b5e01
commit
60310e5a83
1 changed files with 27 additions and 0 deletions
27
src/utils/domains.test.ts
Normal file
27
src/utils/domains.test.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { nodeInfoCache } from '@/utils/domains.ts';
|
||||
import { assert, assertObjectMatch } from '@std/assert';
|
||||
|
||||
Deno.test('NodeInfo request in gleasonator.dev', { sanitizeResources: false }, async () => {
|
||||
const result = await nodeInfoCache.fetch('gleasonator.dev', {
|
||||
signal: AbortSignal.timeout(5000),
|
||||
});
|
||||
|
||||
assertObjectMatch(result, {
|
||||
usage: {
|
||||
users: {},
|
||||
},
|
||||
});
|
||||
|
||||
assert(
|
||||
'total' in result.usage.users &&
|
||||
typeof result.usage.users.total === 'number',
|
||||
);
|
||||
assert(
|
||||
'activeMonth' in result.usage.users &&
|
||||
typeof result.usage.users.activeMonth === 'number',
|
||||
);
|
||||
assert(
|
||||
'activeHalfyear' in result.usage.users &&
|
||||
typeof result.usage.users.activeHalfyear === 'number',
|
||||
);
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue