-
Notifications
You must be signed in to change notification settings - Fork 29
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
12 changed files
with
1,484 additions
and
64 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,4 @@ | |
. "$(dirname "$0")/_/husky.sh" | ||
. "$(dirname "$0")/common.sh" | ||
|
||
npm run devsettingscheck | ||
npm run test |
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 |
---|---|---|
@@ -0,0 +1,134 @@ | ||
import cards from '../src/data/cards' | ||
import cardsbk from './cardsbk' | ||
import { PersonStatusType } from '../src/types/state' | ||
|
||
const dummyStatus1: PersonStatusType = { | ||
bricks: 3, | ||
gems: 0, | ||
recruits: 6, | ||
brickProd: 8, | ||
gemProd: 9, | ||
recruitProd: 11, | ||
tower: 12, | ||
wall: 0, | ||
} | ||
|
||
const dummyStatus2: PersonStatusType = { | ||
bricks: 0, | ||
gems: 4, | ||
recruits: 2, | ||
brickProd: 11, | ||
gemProd: 6, | ||
recruitProd: 8, | ||
tower: 1, | ||
wall: 2, | ||
} | ||
|
||
const dummyStatus3: PersonStatusType = { | ||
bricks: 8, | ||
gems: 13, | ||
recruits: 6, | ||
brickProd: 2, | ||
gemProd: 3, | ||
recruitProd: 6, | ||
tower: 20, | ||
wall: 2, | ||
} | ||
|
||
it('None of the cards is modified', () => { | ||
cards.forEach((card, i) => { | ||
const cardbk = cardsbk[i] | ||
const { effect: e1, ...cardRest } = card | ||
const { effect: e2, ...cardsbkRest } = cardbk | ||
expect(cardRest).toStrictEqual(cardsbkRest) | ||
|
||
let p1, o1, p2, o2 | ||
|
||
// dummyStatus2 vs dummyStatus1 | ||
|
||
p1 = { ...dummyStatus2 } | ||
o1 = { ...dummyStatus1 } | ||
e1(p1, o1) | ||
p2 = { ...dummyStatus2 } | ||
o2 = { ...dummyStatus1 } | ||
e2(p2, o2) | ||
expect(o1).toStrictEqual(o2) | ||
expect(p1).toStrictEqual(p2) | ||
|
||
expect(p1.bricks >= 0).toBeTruthy() | ||
expect(p1.gems >= 0).toBeTruthy() | ||
expect(p1.recruits >= 0).toBeTruthy() | ||
expect(p1.brickProd >= 1).toBeTruthy() | ||
expect(p1.gemProd >= 1).toBeTruthy() | ||
expect(p1.recruitProd >= 1).toBeTruthy() | ||
expect(p1.tower >= 0).toBeTruthy() | ||
expect(p1.wall >= 0).toBeTruthy() | ||
|
||
expect(o1.bricks >= 0).toBeTruthy() | ||
expect(o1.gems >= 0).toBeTruthy() | ||
expect(o1.recruits >= 0).toBeTruthy() | ||
expect(o1.brickProd >= 1).toBeTruthy() | ||
expect(o1.gemProd >= 1).toBeTruthy() | ||
expect(o1.recruitProd >= 1).toBeTruthy() | ||
expect(o1.tower >= 0).toBeTruthy() | ||
expect(o1.wall >= 0).toBeTruthy() | ||
|
||
// dummyStatus1 vs dummyStatus2 | ||
|
||
p1 = { ...dummyStatus1 } | ||
o1 = { ...dummyStatus2 } | ||
e1(p1, o1) | ||
p2 = { ...dummyStatus1 } | ||
o2 = { ...dummyStatus2 } | ||
e2(p2, o2) | ||
expect(o1).toStrictEqual(o2) | ||
expect(p1).toStrictEqual(p2) | ||
|
||
expect(p1.bricks >= 0).toBeTruthy() | ||
expect(p1.gems >= 0).toBeTruthy() | ||
expect(p1.recruits >= 0).toBeTruthy() | ||
expect(p1.brickProd >= 1).toBeTruthy() | ||
expect(p1.gemProd >= 1).toBeTruthy() | ||
expect(p1.recruitProd >= 1).toBeTruthy() | ||
expect(p1.tower >= 0).toBeTruthy() | ||
expect(p1.wall >= 0).toBeTruthy() | ||
|
||
expect(o1.bricks >= 0).toBeTruthy() | ||
expect(o1.gems >= 0).toBeTruthy() | ||
expect(o1.recruits >= 0).toBeTruthy() | ||
expect(o1.brickProd >= 1).toBeTruthy() | ||
expect(o1.gemProd >= 1).toBeTruthy() | ||
expect(o1.recruitProd >= 1).toBeTruthy() | ||
expect(o1.tower >= 0).toBeTruthy() | ||
expect(o1.wall >= 0).toBeTruthy() | ||
|
||
// dummyStatus2 vs dummyStatus3 | ||
|
||
p1 = { ...dummyStatus2 } | ||
o1 = { ...dummyStatus3 } | ||
e1(p1, o1) | ||
p2 = { ...dummyStatus2 } | ||
o2 = { ...dummyStatus3 } | ||
e2(p2, o2) | ||
expect(o1).toStrictEqual(o2) | ||
expect(p1).toStrictEqual(p2) | ||
|
||
expect(p1.bricks >= 0).toBeTruthy() | ||
expect(p1.gems >= 0).toBeTruthy() | ||
expect(p1.recruits >= 0).toBeTruthy() | ||
expect(p1.brickProd >= 1).toBeTruthy() | ||
expect(p1.gemProd >= 1).toBeTruthy() | ||
expect(p1.recruitProd >= 1).toBeTruthy() | ||
expect(p1.tower >= 0).toBeTruthy() | ||
expect(p1.wall >= 0).toBeTruthy() | ||
|
||
expect(o1.bricks >= 0).toBeTruthy() | ||
expect(o1.gems >= 0).toBeTruthy() | ||
expect(o1.recruits >= 0).toBeTruthy() | ||
expect(o1.brickProd >= 1).toBeTruthy() | ||
expect(o1.gemProd >= 1).toBeTruthy() | ||
expect(o1.recruitProd >= 1).toBeTruthy() | ||
expect(o1.tower >= 0).toBeTruthy() | ||
expect(o1.wall >= 0).toBeTruthy() | ||
}) | ||
}) |
Oops, something went wrong.