Remove |callback| in favor of |error| (#5418)

This commit is contained in:
Kirk Scheibelhut
2019-04-08 12:33:32 -07:00
committed by Guangcong Luo
parent e1c389a182
commit b2777f9bf6
10 changed files with 89 additions and 104 deletions

View File

@@ -74,17 +74,17 @@ assert.holdsItem = function (pokemon, message) {
});
};
assert.trapped = function (fn, message) {
assert.trapped = function (fn, unavailable, message) {
assert.throws(
fn, /\[Invalid choice\] Can't switch: The active Pokémon is trapped/,
fn, new RegExp(`\\[${unavailable ? 'Unavailable' : 'Invalid'} choice\\] Can't switch: The active Pokémon is trapped`),
message || 'Expected active Pokemon to be trapped.');
};
assert.cantMove = function (fn, pokemon, move, message) {
assert.cantMove = function (fn, pokemon, move, unavailable, message) {
message = message || `Expected ${pokemon} to not be able to use ${move}.`;
if (pokemon && move) {
assert.throws(
fn, new RegExp(`\\[Invalid choice\\] Can't move:.*${pokemon}.*${move}`, 'i'), message);
fn, new RegExp(`\\[${unavailable ? 'Unavailable' : 'Invalid'} choice\\] Can't move:.*${pokemon}.*${move}`, 'i'), message);
} else {
assert.throws(fn, /\[Invalid choice\] Can't move:/, message);
}
@@ -96,7 +96,7 @@ assert.cantUndo = function (fn, message) {
};
assert.cantTarget = function (fn, move, message) {
assert.cantMove(fn, 'target', move, message || `Expected not to be able to choose a target for ${move}.`);
assert.cantMove(fn, 'target', move, false, message || `Expected not to be able to choose a target for ${move}.`);
};
assert.statStage = function (pokemon, statName, stage, message) {