Add project sorting migration and a few tests (#192)
* Add necessary migrations for project model. * Add a few tests for project model new columns. --------- Co-authored-by: antanst <>
This commit is contained in:
parent
ffcab4caac
commit
1e11ab5fa4
2 changed files with 83 additions and 0 deletions
|
|
@ -87,6 +87,8 @@ describe('Project Model', () => {
|
|||
|
||||
expect(project.active).toBe(false);
|
||||
expect(project.pin_to_sidebar).toBe(false);
|
||||
expect(project.task_show_completed).toBe(false);
|
||||
expect(project.task_sort_order).toBe('created_at:desc');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -108,6 +110,48 @@ describe('Project Model', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('task sorting columns', () => {
|
||||
it('should create project with task_show_completed set to true', async () => {
|
||||
const project = await Project.create({
|
||||
name: 'Test Project',
|
||||
user_id: user.id,
|
||||
task_show_completed: true,
|
||||
});
|
||||
|
||||
expect(project.task_show_completed).toBe(true);
|
||||
});
|
||||
|
||||
it('should create project with custom task_sort_order', async () => {
|
||||
const project = await Project.create({
|
||||
name: 'Test Project',
|
||||
user_id: user.id,
|
||||
task_sort_order: 'priority:asc',
|
||||
});
|
||||
|
||||
expect(project.task_sort_order).toBe('priority:asc');
|
||||
});
|
||||
|
||||
it('should allow task_show_completed to be null', async () => {
|
||||
const project = await Project.create({
|
||||
name: 'Test Project',
|
||||
user_id: user.id,
|
||||
task_show_completed: null,
|
||||
});
|
||||
|
||||
expect(project.task_show_completed).toBeNull();
|
||||
});
|
||||
|
||||
it('should allow task_sort_order to be null', async () => {
|
||||
const project = await Project.create({
|
||||
name: 'Test Project',
|
||||
user_id: user.id,
|
||||
task_sort_order: null,
|
||||
});
|
||||
|
||||
expect(project.task_sort_order).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('associations', () => {
|
||||
it('should belong to a user', async () => {
|
||||
const project = await Project.create({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue