Skip to content

Commit

Permalink
Merge 6edbdf0 into a4041e7
Browse files Browse the repository at this point in the history
  • Loading branch information
OGoodness committed Feb 18, 2021
2 parents a4041e7 + 6edbdf0 commit e4d392e
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 0 deletions.
52 changes: 52 additions & 0 deletions test/console.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import * as Console from "../src/console";

let consoleConnection = new Console.ConsoleConnection()
let dolphineConnection = new Console.DolphinConnection()
let defaultConsoleConnection = {
details: {
consoleNick: 'unknown',
gameDataCursor: new Uint8Array([ 0, 0, 0, 0, 0, 0, 0, 0 ]),
version: '',
clientToken: 0
},
settings: {
ipAddress: '0.0.0.0',
port: 51441
},
status: 0
}
let defaultDolphinConnection = {
details: {
consoleNick: 'unknown',
gameDataCursor: 0,
version: ''
},
settings: {
ipAddress: '0.0.0.0',
port: 51441
},
status: 0
}


describe("Console Connection Class", () => {
beforeEach(()=>{
consoleConnection = new Console.ConsoleConnection()
})
it("should have expected default values", () => {
expect(consoleConnection.getDetails()).toEqual(defaultConsoleConnection.details);
expect(consoleConnection.getSettings()).toEqual(defaultConsoleConnection.settings);
expect(consoleConnection.getStatus()).toEqual(defaultConsoleConnection.status);
});
});

describe("Console Communication Class", () => {
beforeEach(()=>{
dolphineConnection = new Console.DolphinConnection()
})
it("should have expected default values", () => {
expect(dolphineConnection.getDetails()).toEqual(defaultDolphinConnection.details);
expect(dolphineConnection.getSettings()).toEqual(defaultDolphinConnection.settings);
expect(dolphineConnection.getStatus()).toEqual(defaultDolphinConnection.status);
});
});
82 changes: 82 additions & 0 deletions test/melee.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import * as Melee from "../src/melee";

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

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

let foxCharacter = {
id: 2,
name: "Fox",
shortName: "Fox",
colors: ["Default", "Red", "Blue", "Green"],
}
let 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("Characters", () => {
it("returns 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("returns expected ShortName given ID", () => {
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("returns expected character color given ID and index", () => {
expect(Melee.characters.getCharacterColorName(foxCharacter.id, 0)).toEqual(foxCharacter.colors[0])
});
it("returns expected array of characters", () => {
expect(Melee.characters.getAllCharacters()[2]).toEqual(foxCharacter)
});
});

describe("Moves", () => {
it("returns expected ID value", () => {
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("returns expected ShortName given ID", () => {
expect(Melee.moves.getMoveShortName(62)).toEqual('edge')
});
it("returns expected Move Name given ID", () => {
expect(Melee.moves.getMoveName(62)).toEqual('Edge Attack')
});
});

describe("Stages", () => {
it("returns expected ID value", () => {
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("returns expected Move Name given ID", () => {
expect(Melee.stages.getStageName(venomStage.id)).toEqual(venomStage.name)
});
});

0 comments on commit e4d392e

Please sign in to comment.