Simplify bank balance messages in T5 and T6
This commit is contained in:
@@ -188,7 +188,7 @@ for (const game of ['t5','t6']) {
|
||||
});
|
||||
test('startup reports versions, scope, credential validation and journal count safely', () => {
|
||||
const e = engine(game);
|
||||
assert.match(e.logs.join('\n'), /script=2\.0\.2 plugin=1\.2\.0/);
|
||||
assert.match(e.logs.join('\n'), /script=2\.0\.3 plugin=1\.2\.0/);
|
||||
assert(e.logs.some(line => line.includes(`endpoint=${publicEndpoint} server=server credentials=valid`)));
|
||||
assert(e.logs.some(line => line.includes('journal_load=success pending=0')));
|
||||
const invalid = engine(game, {dvars:{tws_bank_token:'secret-invalid-token'}});
|
||||
@@ -304,11 +304,11 @@ for (const game of ['t5','t6']) {
|
||||
const e=engine(game); e.c.level.telemetry_match=undefined; e.run(['.d','all']); assert.equal(e.sent.length,0);
|
||||
});
|
||||
test('balance reads do not journal or alter points', () => {
|
||||
const e=engine(game); e.run(['.b']); assert.equal(e.saved.length,0); assert.equal(e.player.score,3000); assert.match(e.messages[0],/5000/);
|
||||
const e=engine(game); e.run(['.b']); assert.equal(e.saved.length,0); assert.equal(e.player.score,3000); assert.equal(e.messages[0], '^3Bank: ^75000 ^3points');
|
||||
});
|
||||
test('empty balance displays zero and withdrawing all reports insufficient balance', () => {
|
||||
const e = engine(game, {amount:0, balance:0}); e.run(['.b']);
|
||||
assert.equal(e.messages[0], '^3Bank: ^70 ^3points; available: ^70');
|
||||
assert.equal(e.messages[0], '^3Bank: ^70 ^3points');
|
||||
assert.equal(e.saved.length, 0); assert.equal(e.player.score, 3000);
|
||||
const w = engine(game, {amount:0, balance:0, state:'rejected', code:'insufficient_balance'}); w.run(['.w','all']);
|
||||
assert.match(w.messages[0], /Not enough bank balance/);
|
||||
@@ -356,7 +356,7 @@ for (const game of ['t5','t6']) {
|
||||
}
|
||||
assert.equal(ec.requests().length, 0);
|
||||
const e = engine(game, {guid, receiver:ec.request});
|
||||
e.run(['.b']); assert.equal(e.messages[0], '^3Bank: ^70 ^3points; available: ^70');
|
||||
e.run(['.b']); assert.equal(e.messages[0], '^3Bank: ^70 ^3points');
|
||||
e.run(['.w','all']); assert.match(e.messages.at(-1), /Not enough bank balance/);
|
||||
assert.equal(e.player.score, 3000); assert.equal(e.saved[0].decision, 'cancel');
|
||||
e.c.bank_sender().next(); assert.equal(e.saved.length, 0);
|
||||
|
||||
Reference in New Issue
Block a user