Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing To Do list: part 2 #14

Merged
merged 3 commits into from
Jul 14, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add tests for completed status
  • Loading branch information
wayungi committed Jul 14, 2022
commit 278c04c9fcc9a552102aaced7ecb8b4ea10745e4
24 changes: 24 additions & 0 deletions src/tests/methods.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import {
updateTask,
} from '../modules/methods.js';

import { toggleCompleteStatus } from '../modules/task.js';

describe('Todo list app tests', () => {
// Arrange
const task1 = {
Expand Down Expand Up @@ -116,4 +118,26 @@ describe('Todo list app tests', () => {
expect(getTasks()[3].description).toBe('Big balls day');
});
});

describe('Update task completed status', () => {
test('Change task4 completed to true', () => {
const completedTask = toggleCompleteStatus(task4, true);
expect(completedTask.completed).toBe(true);
});

test('Change task4 completed to false', () => {
const completedTask = toggleCompleteStatus(task4, false);
expect(completedTask.completed).toBe(false);
});

test('Change task2 completed to true', () => {
const completedTask = toggleCompleteStatus(task2, true);
expect(completedTask.completed).toBe(true);
});

test('Change task2 completed to false', () => {
const completedTask = toggleCompleteStatus(task2, false);
expect(completedTask.completed).toBe(false);
});
});
});