Skip to content

Commit

Permalink
test: reword descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceau committed Apr 14, 2021
1 parent 9e7a22d commit 089aeb2
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 51 deletions.
108 changes: 59 additions & 49 deletions test/melee.spec.ts
Original file line number Diff line number Diff line change
@@ -1,82 +1,92 @@
import * as Melee from "../src/melee";

let miscMove = { id: 1, name: 'Miscellaneous', shortName: 'misc' }
let unknownMove = { id: -1, name: 'Unknown Move', shortName: 'unknown' }
const miscMove = { id: 1, name: "Miscellaneous", shortName: "misc" };
const unknownMove = { id: -1, name: "Unknown Move", shortName: "unknown" };

let venomStage = { id: 22, name: 'Venom' }
let unknownStage = { id: -1, name: 'Unknown Stage' }
const venomStage = { id: 22, name: "Venom" };
const unknownStage = { id: -1, name: "Unknown Stage" };

let foxCharacter = {
const foxCharacter = {
id: 2,
name: "Fox",
shortName: "Fox",
colors: ["Default", "Red", "Blue", "Green"],
}
let unknownCharacter = {
};

const unknownCharacter = {
id: -1,
name: "Unknown Character",
shortName: "Unknown",
colors: ["Default"],
}

describe("Animations", () => {
it("returns expected directions", () => {
console.log(Melee.animations.getDeathDirection(0))
expect(Melee.animations.getDeathDirection(0)).toEqual('down')
expect(Melee.animations.getDeathDirection(1)).toEqual('left')
expect(Melee.animations.getDeathDirection(2)).toEqual('right')
expect(Melee.animations.getDeathDirection(3)).toEqual('up')
expect(Melee.animations.getDeathDirection(1234)).toEqual(null)
};

describe("when fetching animations", () => {
it("should return the expected death directions", () => {
expect(Melee.animations.getDeathDirection(0)).toEqual("down");
expect(Melee.animations.getDeathDirection(1)).toEqual("left");
expect(Melee.animations.getDeathDirection(2)).toEqual("right");
expect(Melee.animations.getDeathDirection(3)).toEqual("up");
expect(Melee.animations.getDeathDirection(1234)).toEqual(null);
});
});

describe("Characters", () => {
it("returns expected ID value", () => {
expect(Melee.characters.getCharacterInfo(foxCharacter.id)).toEqual(foxCharacter)
describe("when fetching character information", () => {
it("should return the expected ID value", () => {
expect(Melee.characters.getCharacterInfo(foxCharacter.id)).toEqual(foxCharacter);
});
it("returns UnknownMove when move not found", () => {
expect(Melee.characters.getCharacterInfo(69)).toEqual(unknownCharacter)
expect(Melee.characters.UnknownCharacter).toEqual(unknownCharacter)

it("should handle unknown characters", () => {
expect(Melee.characters.getCharacterInfo(69)).toEqual(unknownCharacter);
expect(Melee.characters.UnknownCharacter).toEqual(unknownCharacter);
});
it("returns expected ShortName given ID", () => {
expect(Melee.characters.getCharacterShortName(foxCharacter.id)).toEqual(foxCharacter.shortName)

it("should return the correct character short name", () => {
expect(Melee.characters.getCharacterShortName(foxCharacter.id)).toEqual(foxCharacter.shortName);
});
it("returns expected character Name given ID", () => {
expect(Melee.characters.getCharacterName(foxCharacter.id)).toEqual(foxCharacter.name)

it("should return the correct character name", () => {
expect(Melee.characters.getCharacterName(foxCharacter.id)).toEqual(foxCharacter.name);
});
it("returns expected character color given ID and index", () => {
expect(Melee.characters.getCharacterColorName(foxCharacter.id, 0)).toEqual(foxCharacter.colors[0])

it("should return the correct character color", () => {
expect(Melee.characters.getCharacterColorName(foxCharacter.id, 0)).toEqual(foxCharacter.colors[0]);
});
it("returns expected array of characters", () => {
expect(Melee.characters.getAllCharacters()[2]).toEqual(foxCharacter)

it("should return an array of all characters", () => {
expect(Melee.characters.getAllCharacters()[2]).toEqual(foxCharacter);
});
});

describe("Moves", () => {
it("returns expected ID value", () => {
expect(Melee.moves.getMoveInfo(miscMove.id)).toEqual(miscMove)
describe("when fetching move information", () => {
it("should return the correct move from an ID", () => {
expect(Melee.moves.getMoveInfo(miscMove.id)).toEqual(miscMove);
});
it("returns UnknownMove when move not found", () => {
expect(Melee.moves.getMoveInfo(69)).toEqual(unknownMove)
expect(Melee.moves.UnknownMove).toEqual(unknownMove)

it("should handle unknown moves", () => {
expect(Melee.moves.getMoveInfo(69)).toEqual(unknownMove);
expect(Melee.moves.UnknownMove).toEqual(unknownMove);
});
it("returns expected ShortName given ID", () => {
expect(Melee.moves.getMoveShortName(62)).toEqual('edge')

it("should return the right move short name", () => {
expect(Melee.moves.getMoveShortName(62)).toEqual("edge");
});
it("returns expected Move Name given ID", () => {
expect(Melee.moves.getMoveName(62)).toEqual('Edge Attack')

it("should return the right move name", () => {
expect(Melee.moves.getMoveName(62)).toEqual("Edge Attack");
});
});

describe("Stages", () => {
it("returns expected ID value", () => {
expect(Melee.stages.getStageInfo(venomStage.id)).toEqual(venomStage)
describe("when fetching stage information", () => {
it("should return the stage from an ID", () => {
expect(Melee.stages.getStageInfo(venomStage.id)).toEqual(venomStage);
});
it("returns UnknownStage when stage not found", () => {
expect(Melee.stages.getStageInfo(69)).toEqual(unknownStage)
expect(Melee.stages.UnknownStage).toEqual(unknownStage)

it("should handle unknown stages", () => {
expect(Melee.stages.getStageInfo(69)).toEqual(unknownStage);
expect(Melee.stages.UnknownStage).toEqual(unknownStage);
});
it("returns expected Move Name given ID", () => {
expect(Melee.stages.getStageName(venomStage.id)).toEqual(venomStage.name)

it("should return the right stage name from an ID", () => {
expect(Melee.stages.getStageName(venomStage.id)).toEqual(venomStage.name);
});
});
4 changes: 2 additions & 2 deletions test/stats.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ describe("when calculating stats", () => {
});
});

describe("when using common functions", () => {
it("should return false if required", () => {
describe("when calculating stock information", () => {
it("should handle undefined values", () => {
expect(didLoseStock(undefined, undefined)).toEqual(false);
});
});

0 comments on commit 089aeb2

Please sign in to comment.