-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
177 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,66 @@ | ||
import GridGenerator from '../../src/GridGenerator'; | ||
import GridGenerator from "../../src/GridGenerator"; | ||
|
||
test('getGenerator should work when the request exists', () => { | ||
expect(GridGenerator.getGenerator('rectangle')).toBe(GridGenerator.rectangle); | ||
test("getGenerator should work when the request exists", () => { | ||
expect(GridGenerator.getGenerator("rectangle")).toBe(GridGenerator.rectangle); | ||
}); | ||
|
||
test('getGenerator should work when the request does not exist', () => { | ||
expect(GridGenerator.getGenerator('bogus')).toBeNull(); | ||
test("getGenerator should work when the request does not exist", () => { | ||
expect(GridGenerator.getGenerator("bogus")).toBeNull(); | ||
}); | ||
|
||
test('parallelogram should work', () => { | ||
expect(GridGenerator.parallelogram(0, 1, 0, 1)).toEqual( | ||
[ | ||
{ q: 0, r: 0, s: -0 }, | ||
{ q: 0, r: 1, s: -1 }, | ||
{ q: 1, r: 0, s: -1 }, | ||
{ q: 1, r: 1, s: -2 }, | ||
], | ||
); | ||
test("parallelogram should work", () => { | ||
expect(GridGenerator.parallelogram(0, 1, 0, 1)).toEqual([ | ||
{ meta: {}, q: 0, r: 0, s: -0 }, | ||
{ meta: {}, q: 0, r: 1, s: -1 }, | ||
{ meta: {}, q: 1, r: 0, s: -1 }, | ||
{ meta: {}, q: 1, r: 1, s: -2 } | ||
]); | ||
}); | ||
|
||
test('triangle should work', () => { | ||
expect(GridGenerator.triangle(1)).toEqual( | ||
[ | ||
{ q: 0, r: 0, s: -0 }, | ||
{ q: 0, r: 1, s: -1 }, | ||
{ q: 1, r: 0, s: -1 }, | ||
], | ||
); | ||
test("triangle should work", () => { | ||
expect(GridGenerator.triangle(1)).toEqual([ | ||
{ meta: {}, q: 0, r: 0, s: -0 }, | ||
{ meta: {}, q: 0, r: 1, s: -1 }, | ||
{ meta: {}, q: 1, r: 0, s: -1 } | ||
]); | ||
}); | ||
|
||
test('hexagon should work', () => { | ||
expect(GridGenerator.hexagon(1)).toEqual( | ||
[ | ||
{ q: -1, r: 0, s: 1 }, | ||
{ q: -1, r: 1, s: 0 }, | ||
{ q: 0, r: -1, s: 1 }, | ||
{ q: 0, r: 0, s: -0 }, | ||
{ q: 0, r: 1, s: -1 }, | ||
{ q: 1, r: -1, s: 0 }, | ||
{ q: 1, r: 0, s: -1 }, | ||
], | ||
); | ||
test("hexagon should work", () => { | ||
expect(GridGenerator.hexagon(1)).toEqual([ | ||
{ meta: {}, q: -1, r: 0, s: 1 }, | ||
{ meta: {}, q: -1, r: 1, s: 0 }, | ||
{ meta: {}, q: 0, r: -1, s: 1 }, | ||
{ meta: {}, q: 0, r: 0, s: -0 }, | ||
{ meta: {}, q: 0, r: 1, s: -1 }, | ||
{ meta: {}, q: 1, r: -1, s: 0 }, | ||
{ meta: {}, q: 1, r: 0, s: -1 } | ||
]); | ||
}); | ||
|
||
test('rectangle should work', () => { | ||
expect(GridGenerator.rectangle(3, 3)).toEqual( | ||
[ | ||
{ q: -0, r: 0, s: 0 }, | ||
{ q: 1, r: 0, s: -1 }, | ||
{ q: 2, r: 0, s: -2 }, | ||
{ q: -0, r: 1, s: -1 }, | ||
{ q: 1, r: 1, s: -2 }, | ||
{ q: 2, r: 1, s: -3 }, | ||
{ q: -1, r: 2, s: -1 }, | ||
{ q: 0, r: 2, s: -2 }, | ||
{ q: 1, r: 2, s: -3 }, | ||
], | ||
); | ||
test("rectangle should work", () => { | ||
expect(GridGenerator.rectangle(3, 3)).toEqual([ | ||
{ meta: {}, q: -0, r: 0, s: 0 }, | ||
{ meta: {}, q: 1, r: 0, s: -1 }, | ||
{ meta: {}, q: 2, r: 0, s: -2 }, | ||
{ meta: {}, q: -0, r: 1, s: -1 }, | ||
{ meta: {}, q: 1, r: 1, s: -2 }, | ||
{ meta: {}, q: 2, r: 1, s: -3 }, | ||
{ meta: {}, q: -1, r: 2, s: -1 }, | ||
{ meta: {}, q: 0, r: 2, s: -2 }, | ||
{ meta: {}, q: 1, r: 2, s: -3 } | ||
]); | ||
}); | ||
|
||
test('orientedRectangle should work', () => { | ||
expect(GridGenerator.orientedRectangle(3, 3)).toEqual( | ||
[ | ||
{ q: 0, r: -0, s: 0 }, | ||
{ q: 0, r: 1, s: -1 }, | ||
{ q: 0, r: 2, s: -2 }, | ||
{ q: 1, r: -0, s: -1 }, | ||
{ q: 1, r: 1, s: -2 }, | ||
{ q: 1, r: 2, s: -3 }, | ||
{ q: 2, r: -1, s: -1 }, | ||
{ q: 2, r: 0, s: -2 }, | ||
{ q: 2, r: 1, s: -3 }, | ||
], | ||
); | ||
test("orientedRectangle should work", () => { | ||
expect(GridGenerator.orientedRectangle(3, 3)).toEqual([ | ||
{ meta: {}, q: 0, r: -0, s: 0 }, | ||
{ meta: {}, q: 0, r: 1, s: -1 }, | ||
{ meta: {}, q: 0, r: 2, s: -2 }, | ||
{ meta: {}, q: 1, r: -0, s: -1 }, | ||
{ meta: {}, q: 1, r: 1, s: -2 }, | ||
{ meta: {}, q: 1, r: 2, s: -3 }, | ||
{ meta: {}, q: 2, r: -1, s: -1 }, | ||
{ meta: {}, q: 2, r: 0, s: -2 }, | ||
{ meta: {}, q: 2, r: 1, s: -3 } | ||
]); | ||
}); |
Oops, something went wrong.