Skip to content

Commit

Permalink
refactor(ProjectService): getAllPaths() (#1933)
Browse files Browse the repository at this point in the history
Break down function to getStepPaths() and getLessonPaths(), and clean up getLessonPaths()
  • Loading branch information
hirokiterashima authored Sep 4, 2024
1 parent 1cf99f9 commit 5625d84
Show file tree
Hide file tree
Showing 5 changed files with 250 additions and 212 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ import { FormsModule } from '@angular/forms';

let configService: ConfigService;
let teacherProjectService: TeacherProjectService;

const group0 = {
id: 'group0',
type: 'group',
title: 'Master',
startId: '',
ids: []
};
describe('ExportEventsComponent', () => {
let component: ExportEventsComponent;
let fixture: ComponentFixture<ExportEventsComponent>;
Expand All @@ -31,13 +37,17 @@ describe('ExportEventsComponent', () => {
teacherProjectService = TestBed.inject(TeacherProjectService);
spyOn(teacherProjectService, 'getNodeOrderOfProject').and.returnValue({
idToOrder: {},
nodes: []
nodes: [group0]
});
teacherProjectService.project = {
metadata: {
title: 'Test Project'
}
},
startGroupId: 'group0',
startNodeId: 'group0',
nodes: [group0]
};
teacherProjectService.idToNode['group0'] = group0;
configService = TestBed.inject(ConfigService);
spyOn(configService, 'getPermissions').and.returnValue({
canGradeStudentWork: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,33 @@ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'

let configService: ConfigService;
let teacherProjectService: TeacherProjectService;

const group0 = {
id: 'group0',
type: 'group',
title: 'Master',
startId: '',
ids: []
};
describe('ExportOneWorkgroupPerRowComponent', () => {
let component: ExportOneWorkgroupPerRowComponent;
let fixture: ComponentFixture<ExportOneWorkgroupPerRowComponent>;

beforeEach(() => {
TestBed.configureTestingModule({
declarations: [ExportOneWorkgroupPerRowComponent],
imports: [ClassroomMonitorTestingModule,
declarations: [ExportOneWorkgroupPerRowComponent],
imports: [
ClassroomMonitorTestingModule,
DataExportModule,
MatCheckboxModule,
MatIconModule,
RouterTestingModule],
providers: [DataExportService, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
});
RouterTestingModule
],
providers: [
DataExportService,
provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting()
]
});
fixture = TestBed.createComponent(ExportOneWorkgroupPerRowComponent);
component = fixture.componentInstance;
configService = TestBed.inject(ConfigService);
Expand All @@ -39,15 +51,18 @@ describe('ExportOneWorkgroupPerRowComponent', () => {
teacherProjectService = TestBed.inject(TeacherProjectService);
spyOn(teacherProjectService, 'getNodeOrderOfProject').and.returnValue({
idToOrder: {},
nodes: []
nodes: [group0]
});
teacherProjectService.project = {
nodes: [],
inactiveNodes: [],
metadata: {
title: 'Test Project'
}
},
startGroupId: 'group0',
startNodeId: 'group0',
nodes: [group0]
};
teacherProjectService.idToNode['group0'] = group0;
fixture.detectChanges();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ import { ConfigService } from '../../../services/configService';

let configService: ConfigService;
let teacherProjectService: TeacherProjectService;

const group0 = {
id: 'group0',
type: 'group',
title: 'Master',
startId: '',
ids: []
};
describe('ExportRawDataComponent', () => {
let component: ExportRawDataComponent;
let fixture: ComponentFixture<ExportRawDataComponent>;
Expand All @@ -39,13 +45,17 @@ describe('ExportRawDataComponent', () => {
teacherProjectService = TestBed.inject(TeacherProjectService);
spyOn(teacherProjectService, 'getNodeOrderOfProject').and.returnValue({
idToOrder: {},
nodes: []
nodes: [group0]
});
teacherProjectService.project = {
metadata: {
title: 'Test Project'
}
},
startGroupId: 'group0',
startNodeId: 'group0',
nodes: [group0]
};
teacherProjectService.idToNode['group0'] = group0;
configService = TestBed.inject(ConfigService);
spyOn(configService, 'getPermissions').and.returnValue({
canGradeStudentWork: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ import { ConfigService } from '../../../services/configService';

let configService: ConfigService;
let teacherProjectService: TeacherProjectService;

const group0 = {
id: 'group0',
type: 'group',
title: 'Master',
startId: '',
ids: []
};
describe('ExportStudentWorkComponent', () => {
let component: ExportStudentWorkComponent;
let fixture: ComponentFixture<ExportStudentWorkComponent>;
Expand All @@ -32,15 +38,18 @@ describe('ExportStudentWorkComponent', () => {
teacherProjectService = TestBed.inject(TeacherProjectService);
spyOn(teacherProjectService, 'getNodeOrderOfProject').and.returnValue({
idToOrder: {},
nodes: []
nodes: [group0]
});
teacherProjectService.project = {
nodes: [],
inactiveNodes: [],
metadata: {
title: 'Test Project'
}
},
startGroupId: 'group0',
startNodeId: 'group0',
nodes: [group0]
};
teacherProjectService.idToNode['group0'] = group0;
fixture.detectChanges();
});

Expand Down
Loading

0 comments on commit 5625d84

Please sign in to comment.