Aaron Greenwald
it('should choose the best dev stack given the audience', () => {
givenAudience('ReactILMeetup');
const choice = getBestFedStack();
expect(choice).toContain('React');
});
it('should support creating adding todos to a list', () => {
const todo = {
id: 'todo-item-id',
title: 'some title'
};
todoList.add(todo);
expect(todoList.get('todo-item-id')).toBe(todo);
});
it('should support creating adding todos to a list', () => {
const todo = new TodoBuilder()
.withId('todo-item-id')
.build();
todoList.add(todo);
expect(todoList.get('todo-item-id')).toBe(todo);
});
it('should support deleting attachments from a todo', () => {
const todo = new TodoBuilder()
.withAttachments([
new AttachmentBuilder().build()
])
.build();
const updatedTodo = todo.deleteAttachments();
expect(updatedTodo.attachments).toBe(null);
});
const todo = new TodoBuilder()
.withAttachments([
new AttachmentBuilder()
.withId('attachment-0-id')
.build(),
new AttachmentBuilder()
.withId('attachment-1-id')
.build()
])
.build();
function aTodoWithAttachments(length = 0) {
return new TodoBuilder()
.withAttachments([
...new Array(length).fill(0).map((_, i) =>
new AttachmentBuilder()
.withId(`attachment-${i}-id`)
.build()
)
])
.build();
}
const todo = aTodoWithAttachments(3);
todo.deleteFirstAttachment();
expect(todo.attachments.length).toBe(2);
it('should open the new todo window on button press', () => {
todoListDriver.loadPage();
todoListDriver.when.newTodoButtonClicked();
expect(driver.get.newTodoModal()).toBeVisible();
});
class TodoListDriver extends PageDriver {
loadPage() {
this.driver.navigateTo('/todos');
}
when = {
newTodoButtonClicked () {
$('#new-todo').click();
}
}
get = {
newTodoModal () {
return $('#new-todo');
}
}
}
it('should render footer when loading', () => {
givenAppInLoadingState();
expect(footer).toBeVisible();
});