updates
This commit is contained in:
parent
5368464042
commit
937f44defe
100 changed files with 10185 additions and 2042 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import assert from 'node:assert/strict';
|
||||
import { readdirSync, readFileSync } from 'node:fs';
|
||||
import { test } from 'node:test';
|
||||
import { loadCards } from '../src/cards.ts';
|
||||
import { loadCards } from '../src/load.ts';
|
||||
import { randomDeck, validateDeck } from '../src/deck.ts';
|
||||
import { makeRng } from '../src/rng.ts';
|
||||
import { DEFAULT_RULES } from '../src/rules.ts';
|
||||
|
|
@ -11,14 +11,14 @@ const pool = loadCards();
|
|||
|
||||
test('cards.csv loads every playable card', () => {
|
||||
const count = (kind: string) => pool.all.filter((c) => c.kind === kind).length;
|
||||
assert.equal(count('avatar'), 8);
|
||||
assert.equal(count('anomaly'), 8);
|
||||
assert.equal(count('server'), 13);
|
||||
assert.equal(count('program'), 28);
|
||||
assert.equal(count('hardware'), 16);
|
||||
assert.equal(count('execution'), 18);
|
||||
assert.equal(pool.byName.get('Broken Bits')?.cores, 4);
|
||||
assert.equal(pool.byName.get('Carbon NanoBots')?.slots, 4);
|
||||
assert.equal(pool.byName.get('Quantum Coprocessor')?.ram, 9);
|
||||
assert.equal(pool.byName.get('Quantum Coprocessor')?.bandwidth, 9);
|
||||
});
|
||||
|
||||
test('every card has a script written for its current text', () => {
|
||||
|
|
@ -37,7 +37,7 @@ test('every card has its own test', () => {
|
|||
test('set 2 loads on request, is well formed, and is unscripted', () => {
|
||||
const two = loadCards(undefined, [2]);
|
||||
const count = (kind: string) => two.all.filter((c) => c.kind === kind).length;
|
||||
assert.equal(count('avatar'), 12);
|
||||
assert.equal(count('anomaly'), 12);
|
||||
assert.equal(count('server'), 7);
|
||||
assert.equal(count('program'), 17);
|
||||
assert.equal(count('hardware'), 8);
|
||||
|
|
@ -46,16 +46,16 @@ test('set 2 loads on request, is well formed, and is unscripted', () => {
|
|||
assert.equal(c.set, 2, c.name);
|
||||
assert.ok(!pool.byName.has(c.name), `${c.name} clashes with a set 1 card`);
|
||||
assert.ok(c.text || c.ability, `${c.name} has text`);
|
||||
if (c.kind === 'avatar') {
|
||||
if (c.kind === 'anomaly') {
|
||||
assert.equal(c.cores + c.slots, 6, `${c.name}: Cores + Slots = 6`);
|
||||
assert.equal(c.health, { 4: 9, 3: 10, 2: 12 }[c.cores], `${c.name}: Health by Cores`);
|
||||
assert.ok(c.type && c.ability && c.ability.cost >= 3 && c.ability.cost <= 5, `${c.name}: typed, Ability 3-5 RAM`);
|
||||
assert.ok(c.type && c.ability && c.ability.cost >= 3 && c.ability.cost <= 5, `${c.name}: typed, Ability 3-5 Gb`);
|
||||
} else if (c.kind === 'program') {
|
||||
assert.ok(c.type && c.ram >= 4 && c.ram <= 6, `${c.name}: typed, 4-6 RAM`);
|
||||
assert.ok(c.type && c.bandwidth >= 4 && c.bandwidth <= 6, `${c.name}: typed, 4-6 Gb`);
|
||||
} else if (c.kind === 'execution') {
|
||||
assert.ok(c.ram >= 3 && c.ram <= 5, `${c.name}: 3-5 RAM`);
|
||||
assert.ok(c.bandwidth >= 3 && c.bandwidth <= 5, `${c.name}: 3-5 Gb`);
|
||||
} else if (c.kind === 'hardware') {
|
||||
assert.ok(c.ram >= 4 && c.ram <= 7, `${c.name}: 4-7 RAM`);
|
||||
assert.ok(c.bandwidth >= 4 && c.bandwidth <= 7, `${c.name}: 4-7 Gb`);
|
||||
}
|
||||
}
|
||||
const all = loadCards(undefined, 'all');
|
||||
|
|
@ -76,7 +76,7 @@ test('deck validation catches size, kind and copy problems', () => {
|
|||
const deck = randomDeck(pool, makeRng(1), DEFAULT_RULES);
|
||||
deck.main[0] = deck.main[1] = deck.main[2] = 'Execute: Fork';
|
||||
deck.servers.pop();
|
||||
deck.avatars[0] = 'Cloud Compute';
|
||||
deck.anomalies[0] = 'Cloud Compute';
|
||||
const errors = validateDeck(pool, deck, DEFAULT_RULES).join('\n');
|
||||
assert.match(errors, /Servers: 19 cards/);
|
||||
assert.match(errors, /"Cloud Compute" is a server/);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue