Phase7
Some checks failed
CI / Node — lint, typecheck, test, build (push) Failing after 9s
CI / Go — node-agent tests (push) Failing after 8s
CI / Go — edge-gateway build (push) Successful in 14s

This commit is contained in:
smueller
2026-06-26 13:20:55 +02:00
parent 49a98ee31d
commit ab21f53cdd
86 changed files with 1207 additions and 63 deletions

View File

@@ -0,0 +1,23 @@
import { describe, expect, it } from 'vitest';
import {
calculateUsageCredits,
parseMinecraftListOutput,
} from './index';
describe('metering', () => {
it('charges credits by RAM-GB-minutes', () => {
expect(calculateUsageCredits(1024, 60)).toBe(1);
expect(calculateUsageCredits(2048, 60)).toBe(2);
expect(calculateUsageCredits(512, 30)).toBe(1);
});
it('parses minecraft list command output', () => {
expect(
parseMinecraftListOutput('There are 2 of a max of 20 players online: Steve, Alex'),
).toBe(2);
expect(
parseMinecraftListOutput('There are 0 of a maximum of 10 players online:'),
).toBe(0);
});
});