This is intended as a starter project for newer contributors but if you're already a contributor for some time, you can help as well.
NOTE: Please ping @nithusha21 if you have any questions about this issue or would like to be assigned to some part of it.
In order to prevent future regressions, we want to ensure that all services in our frontend codebase are thoroughly tested. If it's your first time here, please read carefully the guide of how to get started with frontend unit testing: Guide for writing frontend tests. Please use this guide as your helper, all the instructions of how to test properly is in it.
Also, here is Oppia's wiki page for running the client-side Karma tests.
The services are separated by three levels of complexity:
| Complexity | Easy | Medium | Hard |
|:---------------:|:----------------:|:---------------:|:------------------:|
| Number of lines | up to 100 lines | up to 250 lines | at least 250 lines |
Then, it doesn't matter if you're new to unit test or if you're looking for something more challenging, there will be service for you work with.
Each file is marked with two information that will help you to decide which service to pick. For example:
- [ ] A - B service-name.service.ts
A means the service complexity: E for Easy, M for medium and H for Hard.
B means if the service has a spec file: Y for Yes and N for No.
Spec files for services tests consist of the name of the service, followed by .spec.ts
or Spec.ts
, it depends of the service file name structure:
- Use
.spec.ts
for services like: service-name.service.ts
- Use
Spec.ts
for services like: ServiceNameService.ts
When writing tests, if a spec file already exists for the service you have picked, then edit the existing file. If a spec file isn't present yet, create a new file and name it accordingly. You can also take a look at the existing spec files for different services to get an idea on how to get started.
Note: We are currently in the process of upgrading AngularJS to Angular. If the service is written in AngularJS, write the test in AngularJS. If the service is written in Angular, write the test in Angular. We would also prefer to cover all Angular files before moving to AngularJS files to prevent extra work during the migration.
If you'd like to help with this issue, please select a file from the list below, comment on the thread with the file name or any query you'd like to be assigned, and submit a PR when you've completed writing the test. Once the PR is submitted, you can tick the checkboxes.
PR's for reference: #4135 #8916 #8934
Files to write tests for or increase until 100%:
Angular files
- core/templates
- components/graph-services
- [ ] H - N graph-layout.service.ts
- components/state-editor
- [ ] M - Y state-editor.service.ts @Deepam101
- [ ] M - Y state-property.service.ts
- domain/collection
- [ ] M - Y collection-node.model.ts @Nisarg-Chaudhari
- [ ] H - Y collection.model.ts
- [ ] E - N collection-playthrough.model.ts @karthikshetty03
- [ ] M - Y editable-collection-backend-api.service.ts
- [ ] M - Y read-only-collection-backend-api.service.ts
- domain/question
- [ ] E - Y pretest-question-backend-api.service.ts @wcascades
- domain/skill
- [ ] H - Y SkillObjectFactory.ts
- domain/state_card
- [ ] M - Y StateCardObjectFactory.ts
- domain/story
- [ ] M - Y editable-story-backend-api.service.ts @kaushambisharma
- [ ] H - Y StoryContentsObjectFactory.ts
- [ ] H - Y story-node.model.ts
- domain/topic
- [ ] M - Y SubtopicObjectFactory.ts
- [ ] M - Y SubtopicPageObjectFactory.ts
- [ ] H - Y TopicObjectFactory.ts
- domain/topics_and_skills_dashboard
- [ ] E - Y topics-and-skills-dashboard-backend-api.service.ts @michaelw54
- domain/utilities
- [ ] M - Y language-util.service.ts @laujamie
- [ ] M - Y url-interpolation.service.ts
- expressions
- [ ] M - Y expression-evaluator.service.ts
- [ ] M - Y expression-interpolation.service.ts
- pages/community-dashboard-page
- [ ] M - Y contribution-opportunities-backend-api.service.ts
- pages/email-dashboard-pages
- [ ] M - Y email-dashboard-data.service.ts @siddharthmehta02
- pages/exploration-editor-page
- [ ] H - N exploration-diff.service.ts
- [ ] M - Y version-tree.service.ts
- pages/exploration-player-page
- [x] E - Y audio-translation-manager.service.ts @Nik-09
- [ ] M - Y answer-classification.service.ts
- [ ] M - Y audio-preloader.service.ts
- [ ] M - Y current-interaction.service.ts
- [ ] E - N exploration-recommendations.service.ts @TheoLipeles
- [ ] M - Y learner-answer-info.service.ts
- [ ] E - N player-correctness-feedback-enabled.service.ts @soumyo123-prog
- [ ] M - Y player-transcript.service.ts
- [ ] H - N question-player-engine.service.ts @ehwu
- [ ] H - N stats-reporting.service.ts
- pages/story-editor-page
- [ ] M - Y story-editor-state.service.ts
- services
- [ ] E - N autogenerated-audio-player.service.ts
- [ ] H - Y context.service.ts @HarshKhilawala
- [ ] E - Y csrf-token.service.ts @Nik-09
- [ ] E - Y html-escaper.service.ts @Nik-09
- [ ] M - N messenger.service.ts
- [ ] E - Y promo-bar-backend-api.service.ts @tanishq67
- [ ] M - N request-interceptor.service.ts
- [ ] M - Y state-top-answers-stats.service.ts
- [ ] E - Y utils.service.ts @HarshKhilawala
- extensions
- classifiers
- [ ] H - Y python-program.tokenizer.ts
- [ ] H - Y svm-prediction.service.ts
- extensions
- [ ] M - N base-interaction-validation.service.ts
- [ ] H - Y code-repl-prediction.service.ts
- [ ] E - Y continue-rules.service.ts
- [ ] M - Y drag-and-drop-sort-input-validation.service.ts
- [ ] E - N end-exploration-rules.service.ts @SAEb-ai
- [ ] H - Y fraction-input-validation.service.ts
- [ ] E - N graph-detail.service.ts @safwan20
- [ ] M - Y graph-input-rules.service.ts
- [ ] M - Y graph-input-validation.service.ts
- [ ] M - N graph-utils.service.ts @atpug22
- [ ] M - Y item-selection-input-validation.service.ts
- [ ] M - Y music-notes-input-rules.service.ts
- [ ] E - N music-phrase-player.service.ts @HarshKhilawala
- [ ] M - Y number-with-units-validation.service.ts @akshayrathi2102
- [ ] M - Y numeric-input-validation.service.ts @EeshaArif
AngularJS files
- core/templates
- components/entity_creation
- [ ] M - N exploration-creation.service.ts
- [ ] E - N skill-creation.service.ts @LakmaNeha
- [ ] E - N story-creation.service.ts @taiwo2
- [ ] E - N topic-creation.service.ts
- domain/collection
- [ ] H - Y collection-update.service.ts
- domain/question
- [ ] M - Y question-update.service.ts
- domain/skill
- [ ] H - Y skill-update.service.ts
- domain/story
- [ ] H - Y story-update.service.ts
- pages/community-dashboard-page
- [ ] M - Y contribution-and-review.service.ts
- [ ] E - N contribution-opportunities.service.ts
- [ ] M - N translate-text.service.ts
- pages/exploration-editor-page
- [ ] M - N change-list.service.ts
- [ ] H - N exploration-save.service.ts
- [ ] H - Y exploration-states.service.ts
- [ ] E - N state-tutorial-first-time.service.ts @safwan20
- [ ] M - N suggestion-modal-for-exploration-editor.service.ts
- [ ] M - N voiceover-recording.service.ts
- pages/exploration-player-page
- [ ] H - N exploration-engine.service.ts
- [ ] H - Y exploration-player-state.service.ts
- [ ] E - N fatigue-detection.service.ts
- [ ] M - N hint-and-solution-modal.service.ts @Radesh-kumar
- [ ] M - Y learner-answer-info.service.ts
- [ ] E - N refresher-exploration-confirmation-modal.service.ts
- [ ] M - N suggestion-modal-for-exploration-player.service.ts
- pages/skill-editor-page
- [ ] M - Y skill-editor-state.service.ts
- pages/topic_editor
- [ ] topic-editor-state.service.ts
- services
- [ ] M - N audio-player.service.ts
- [ ] E - Y image-upload-helper.service.tests @sachinchauhan2889
- [ ] E - N translation-file-hash-loader.service.ts
Click to see the list of completed work.
- components/forms
- [x] FormBuilder.js -- @unit-00
- components/state_editor
- [x] StateParamChangesService.ts @safwan20
- [x] StateHintsService.ts @safwan20
- [x] StateNameService.ts @safwan20
- domain/classifier
- [x] AnswerClassificationResultObjectFactory.js @jervis446 #4305
- [x] ClassifierObjectFactory.js @jervis446 #4305
- [x] PredictionResultObjectFactory.ts @marianazangrossi
- domain/classroom
- [x] E - Yclassroom-backend-api.service.ts @krishnarao22
- domain/collection
- [x] CollectionRightsBackendApiService.ts @marianazangrossi
- [x] CollectionRightsObjectFactory.ts @marianazangrossi
- [x] CollectionValidationService.ts @marianazangrossi
- domain/creator_dashboard
- [x] CreatorDashboardBackendApiService.ts @marianazangrossi
- domain/exploration
- [x] AnswerStatsObjectFactory.ts @marianazangrossi
- [x] ExplorationObjectFactory.ts @marianazangrossi
- [x] HintObjectFactory.js @YashJipkate
- [x] InteractionObjectFactory.js @YashJipkate
- [x] OutcomeObjectFactory.js @abhaygupta97
- [x] ParamChangeObjectFactory.ts @marianazangrossi
- [x] ParamChangesObjectFactory.ts - @lakshay-angrish
- [x] ParamSpecObjectFactory.ts @marianazangrossi
- [x] ParamSpecsObjectFactory.ts @marianazangrossi
- [x] RuleObjectFactory.ts @abhayraghuwanshi
- [x] SolutionObjectFactory.ts @marianazangrossi
- [x] TriggerObjectFactory.js @17bcs029 (removed the file)
- [x] WrittenTranslationsObjectFactory.ts @marianazangrossi
- domain/learner_dashboard
- [x] LearnerDashboardActivityIdsObjectFactory @marianazangrossi
- [x] LearnerDashboardBackendApiService.js @nithusha21 @marianazangrossi
- [x] LearnerDashboardIdsBackendApiService.js @nithusha21 @marianazangrossi
- [x] LearnerPlaylistService.js @nithusha21 #4135
- domain/objects
- [x] UnitsObjectFactory.ts - @felicityzhao99
- domain/question
- [x] EditableQuestionBackendApiService.ts @marianazangrossi
- [x] QuestionBackendApiService.ts @jimbyo
- [x] QuestionObjectFactory.ts @jimbyo
- domain/sidebar @WickedBrat #4520
- [x] SidebarStatusService.js
- domain/skill
- [x] ConceptCardBackendApiService.ts @marianazangrossi
- [x] EditableSkillBackendApiService.ts @marianazangrossi
- [x] MisconceptionObjectFactory.ts @marianazangrossi
- [x] SkillRightsObjectFactory.ts @marianazangrossi
- [x] SkillRightsBackendApiService.ts @marianazangrossi
- domain/state
- [x] StateObjectFactory.ts @marianazangrossi
- domain/statistics
- [x] FeedbackImprovementTaskObjectFactory.ts @marianazangrossi
- [x] PlaythroughImprovementTaskObjectFactory.ts @marianazangrossi
- [x] SuggestionImprovementTaskObjectFactory.ts @marianazangrossi
- domain/suggestion
- [x] SuggestionThreadObjectFactory.ts @marianazangrossi
- domain/summary
- [x] ExplorationSummaryBackendApiService.ts @marianazangrossi
- domain/topic
- [x] EditableTopicBackendApiService.ts @marianazangrossi
- [x] TopicRightsBackendApiService.ts @marianazangrossi
- [x] TopicRightsObjectFactory.ts @marianazangrossi
- domain/user
- [x] UserInfoObjectFactory.ts
- domain/utilities
- [x] AudioLanguageObjectFactory.js @hoangviet1993
- [x] AutogeneratedAudioLanguageObjectFactory.js @hoangviet1993
- [x] BrowserCheckerService.ts @marianazangrossi
- pages/creator_dashboard
- [x] SuggestionModalForCreatorViewService.ts @marianazangrossi
- pages/exploration_editor
- [x] AnswerGroupsCacheService.js @vinitamurthi
- [x] AutosaveInfoModalService.ts @marianazangrossi
- [x] ChangesInHumanReadableFormService.ts @marianazangrossi
- [x] CompareVersionService.ts @marianazangrossi
- [x] EditorFirstTimeEventsService.ts @marianazangrossi
- [x] E - N exploration-category.service.ts @safwan20
- [x] ExplorationCorrectnessFeedbackService.ts @marianazangrossi
- [x] ExplorationDataService.ts @marianazangrossi
- [x] ExplorationPropertyService.ts @marianazangrossi
- [x] ExplorationRightsService.ts @marianazangrossi
- [x] E - N exploration-tags.service.ts @safwan20
- [x] ExplorationWarningsService.ts @marianazangrossi
- [x] GraphDataService.ts @marianazangrossi
- [x] InteractionDetailsCacheService.js @vinitamurthi
- [x] ImprovementModalService.ts @marianazangrossi
- [x] LearnerAnswerDetailsDataService.ts @marianazangrossi
- [x] ParameterMetadataService.ts @marianazangrossi
- [x] ResponsesService.ts @marianazangrossi
- [x] RouterService.ts @marianazangrossi
- [x] SolutionVerificationService.ts @marianazangrossi
- [x] ThreadDataService.ts @marianazangrossi
- [x] ThreadStatusDisplayService.js @paroothisumit #4606
- [x] TranslationLanguageService.ts @marianazangrossi
- [x] UserEmailPreferencesService.ts @Arnesh07
pages/exploration_player
- [x] AudioTranslationLanguageService.ts @marianazangrossi
- [x] HitsAndSolutionManager.service.ts @marianazangrossi
- [x] ImagePreloaderService.ts @marianazangrossi
- [x] StateClassifierMappingService.ts @marianazangrossi
pages/skill_editor
- [x] SkillEditorRoutingService.ts @marianazangrossi
- services
- [x] AlertsService.ts @marianazangrossi
- [x] AssetsBackendApiService.ts @marianazangrossi
- [x] AutoplayedVideosService.js @proishan11 #4805
- [x] BackgroundMaskService.js @aks681
- [x] CodeNormalizerService.ts @marianazangrossi
- [x] ConstructTranslationIdsService.ts @marianazangrossi
- [x] EditabilityServices.js @square-1111
- [x] E - N exploration-features.service.ts @abhayraghuwanshi
- [x] IdGenerationService.js @lilithxxx
- [x] DateTimeFormatService.ts @marianazangrossi
- [x] DebouncerService.ts @marianazangrossi
- [x] DeviceInfoService.ts @marianazangrossi
- [x] DocumentAttributeCustomizationService.ts @marianazangrossi
- [x] ExtensionTagAssemblerService.ts @marianazangrossi
- [x] FocusManagerService.js @aks681
- [x] LocalStorageService.ts @marianazangrossi
- [x] LoggerService.ts @marianazangrossi
- [x] MetaTagCustomizationService.ts @marianazangrossi
- [x] NavigationService.ts @marianazangrossi
- [x] NestedDirectivesRecursionTimeoutPreventionService.ts @marianazangrossi
- [x] PageTitleService.ts @marianazangrossi
- [x] PlayerPositionService.js @ujjwalgulecha
- [x] PlaythroughIssuesBackendApiService.ts @marianazangrossi
- [x] PlaythroughIssuesService.ts @marianazangrossi
- [x] QuestionsListService.ts @marianazangrossi
- [x] RteHelperService.ts @marianazangrossi
- [x] SchemaDefaultValueService.ts @marianazangrossi
- [x] SchemaUndefinedLastElementService.ts @marianazangrossi
- [x] SearchService.ts @marianazangrossi
- [x] SiteAnalyticsService.ts @marianazangrossi
- [x] SpeechSynthesisChunkerService.ts @marianazangrossi
- [x] SuggestionModalService.ts @marianazangrossi
- [x] TrainingDataEditorPainelService.ts @marianazangrossi
- [x] TrainingModalService.ts @marianazangrossi
- [x] UrlService.ts @marianazangrossi
- [x] UserService.ts @marianazangrossi
- [x] ValidatorsService.ts @marianazangrossi
- [x] WindowDimensionsService.ts @marianazangrossi
- [x] WindowRefService.ts @marianazangrossi
- components/ratings
- [x] E - Y rating-computation.service.ts @laujamie
- domain/editor
- [x] M - N base-undo-redo.service.ts
- [x] E - N question-undo-redo.service.ts @safwan20
- domain/exploration
- [x] M - N AnswerGroupObjectFactory.ts @safwan20
- [x] M - Y editable-exploration-backend-api.service.ts @shavavo
- [x] M - Y RecordedVoiceoversObjectFactory.ts @shavavo
- [x] M - Y StatesObjectFactory.ts @kevjumba
- domain/feedback_thread
- [x] M - Y FeedbackThreadSummaryObjectFactory.ts
- domain/objects
- [x] H - Y NumberWithUnitsObjectFactory.ts
Other services:
- [x] E - N collection-creation.service.ts @Hadyn
- [x] E - N exploration-embed-button.service.ts
- [x] E - N question-creation.service.ts @mhotiger
- [x] E - N state-content.service.ts @safwan20
- [x] E - N state-customization-args.service.ts @safwan20
- [x] E - N state-interaction-id.service.ts @safwan20
- [x] E - N state-recorded-voiceovers.service.ts @safwan20
- [x] E - N state-solicit-answer-details.service.ts @safwan20
- [x] E - N state-solution.service.ts @safwan20
- [x] E - N state-written-translations.service.ts @safwan20
- [x] M - Y ConceptCardObjectFactory.ts
- [x] E - Y SkillDifficultyObjectFactory.ts @tianqi-wu
- domain/statistics
- [x] E - Y learner-answer-details-backend-api.service.ts @arpit1912
- domain/story_viewer
- [x] E - Y story-viewer-backend-api.service.ts @EricZLou
- [x] H - Y topic-update.service.ts @shavavo
- [x] E - N AudioFileObjectFactory.ts @safwan20
- [x] E - N FileDownloadRequestObjectFactory.ts @safwan20
- [x] E - N ImageFileObjectFactory.ts @safwan20
- [x] H - Y expression-syntax-tree.service.ts @mertdeg2
- [x] E - Y expression-type-parser.service.ts
- [x] M - Y collection-editor-state.service.ts
- [x] E - N question-suggestion.service.ts
- [x] E - N exploration-automatic-text-to-speech.service.ts @safwan20
- [x] E - N exploration-init-state-name.service.ts
- [x] E - N exploration-language-code.service.ts
- [x] E - N exploration-objective.service.ts
- [x] E - N exploration-param-changes.service.ts @safwan20
- [x] E - N exploration-param-specs.service.ts @safwan20
- [x] E - N exploration-title.service.ts
- [x] E - Y state-improvement-suggestion.service.ts
- [x] E - Y player-position.service.ts @tianqi-wu
- [x] E - Y prediction-algorithm-registry.service.ts @rriyaldhi
- [x] E - N suggestion-modal-for-learner-dashboard.service.ts @hulyak
- [x] TopicEditorRoutingService.ts @amanbora
- [x] E - N compute-graph.service.ts
- [x] E - Y improvement-task.service.ts
- [x] H - Y playthrough.service.ts
- [x] E - N pencil-code-editor-validation.service.ts @safwan20
Note: For a guide on how to access Oppia's webpages, see this.
frontend good first issue