Skip to content

Commit 7a1e132

Browse files
committed
t
1 parent 1c049df commit 7a1e132

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

webapp/src/RoleSheet.spec.tsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,34 @@ describe('RoleSheet', () => {
4545

4646
expect(mockScorePoints).toHaveBeenCalledWith("Typing", 2);
4747
})
48+
49+
it(`scores two points Talking using the checkboxes when submitting`, async () => {
50+
const mockScorePoints = jest.fn();
51+
render(<RoleSheet role="Talking" position="Talking" player={new Player("Roger")} scorePoints={mockScorePoints} />);
52+
await checkTodo('Talking-0');
53+
await checkTodo('Talking-1');
54+
55+
await clickEarnPoints();
56+
57+
expect(mockScorePoints).toHaveBeenCalledWith("Talking", 2);
58+
})
4859
})
4960

5061

51-
async function clickEarnPoints() {
52-
const submitButton = screen.getByRole('button', { name: /Earn Points/ });
62+
async function checkTodo(todo) {
63+
const firstCheckbox = document.getElementById(todo) as HTMLInputElement;
5364
await act(async () => {
54-
userEvent.click(submitButton);
65+
userEvent.click(firstCheckbox);
5566
});
5667
}
5768

58-
async function checkTodo(todo) {
59-
const firstCheckbox = document.getElementById(todo) as HTMLInputElement;
69+
async function clickEarnPoints() {
70+
const submitButton = screen.getByRole('button', { name: /Earn Points/ });
6071
await act(async () => {
61-
userEvent.click(firstCheckbox);
72+
userEvent.click(submitButton);
6273
});
6374
}
75+
6476
// TODO if canEarnPoints for role, show skills of role
6577
// cannot rotate until players have filled the form
6678
// TODO use it.each ??? but maybe its too clever?

0 commit comments

Comments
 (0)