-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Authoring): Move inactive lesson duplicates steps (#1641)
- Loading branch information
1 parent
733b3f8
commit b10e853
Showing
4 changed files
with
194 additions
and
15 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
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,48 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
import { MoveNodesService } from '../../assets/wise5/services/moveNodesService'; | ||
import { copy } from '../../assets/wise5/common/object/object'; | ||
import demoProjectJSON_import from './sampleData/curriculum/Demo.project.json'; | ||
import { TeacherProjectService } from '../../assets/wise5/services/teacherProjectService'; | ||
import { StudentTeacherCommonServicesModule } from '../student-teacher-common-services.module'; | ||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
|
||
let demoProjectJSON: any; | ||
const inactiveLessonId1 = 'group6'; | ||
const inactiveLessonId2 = 'group7'; | ||
let service: MoveNodesService; | ||
let teacherProjectService: TeacherProjectService; | ||
|
||
describe('MoveNodesService', () => { | ||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [HttpClientTestingModule, StudentTeacherCommonServicesModule], | ||
providers: [MoveNodesService, TeacherProjectService] | ||
}); | ||
service = TestBed.inject(MoveNodesService); | ||
demoProjectJSON = copy(demoProjectJSON_import); | ||
teacherProjectService = TestBed.inject(TeacherProjectService); | ||
teacherProjectService.setProject(demoProjectJSON); | ||
}); | ||
moveInactiveLessonAfterInactiveLesson(); | ||
}); | ||
|
||
function moveInactiveLessonAfterInactiveLesson() { | ||
describe('move an inactive lesson after another inactive lesson', () => { | ||
it('moves inactive lesson', () => { | ||
let inactiveNodeIds = teacherProjectService.getInactiveNodeIds(); | ||
expect(inactiveNodeIds.indexOf(inactiveLessonId1)).toBeLessThan( | ||
inactiveNodeIds.indexOf(inactiveLessonId2) | ||
); | ||
service.moveNodesAfter([inactiveLessonId1], inactiveLessonId2); | ||
inactiveNodeIds = teacherProjectService.getInactiveNodeIds(); | ||
expect(inactiveNodeIds.indexOf(inactiveLessonId1)).toBeGreaterThan( | ||
inactiveNodeIds.indexOf(inactiveLessonId2) | ||
); | ||
}); | ||
it('number of inactive nodes does not change', () => { | ||
const numInactiveNodes = teacherProjectService.getInactiveNodes().length; | ||
service.moveNodesAfter([inactiveLessonId1], inactiveLessonId2); | ||
expect(teacherProjectService.getInactiveNodes().length).toEqual(numInactiveNodes); | ||
}); | ||
}); | ||
} |
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