-
Notifications
You must be signed in to change notification settings - Fork 0
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
4 changed files
with
63 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`paralysis target should sleep and not be able to attack 1`] = ` | ||
"*asperiores* использовал _Вторая жизнь_ на *asperiores* с эффектом 10 | ||
\\[ 📖80 ]" | ||
`; |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import casual from 'casual'; | ||
import CharacterService from '@/arena/CharacterService'; | ||
import GameService from '@/arena/GameService'; | ||
import TestUtils from '@/utils/testUtils'; | ||
import secondLife from './secondLife'; | ||
|
||
// npm t src/arena/magics/secondLife.test.ts | ||
|
||
describe('secondLife', () => { | ||
let game: GameService; | ||
|
||
beforeAll(() => { | ||
casual.seed(1); | ||
}); | ||
|
||
beforeEach(async () => { | ||
const initiator = await TestUtils.createCharacter({ prof: 'p', magics: { secondLife: 1 } }); | ||
|
||
await CharacterService.getCharacterById(initiator.id); | ||
|
||
game = new GameService([initiator.id]); | ||
}); | ||
|
||
beforeEach(() => { | ||
jest.spyOn(global.Math, 'random').mockReturnValue(0.5); | ||
}); | ||
|
||
afterEach(() => { | ||
jest.spyOn(global.Math, 'random').mockRestore(); | ||
}); | ||
|
||
it('target should be alive', async () => { | ||
game.players.players[0].proc = 1; | ||
game.players.players[0].stats.set(secondLife.costType, secondLife.cost); | ||
game.players.players[0].stats.set('hp', -10); | ||
|
||
secondLife.cast(game.players.players[0], game.players.players[0], game); | ||
|
||
expect(game.players.players[0].stats.val('hp')).toBe(0.05); | ||
expect(TestUtils.normalizeRoundHistory(game.getRoundResults())).toMatchSnapshot(); | ||
}); | ||
}); |
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