Test frontend services
See original GitHub issueThis 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
- components/graph-services
- pages/exploration-player-page
- 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
- classifiers
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
- components/entity_creation
Click to see the list of completed work.
- components/forms
- FormBuilder.js – @unit-00
- components/state_editor
- domain/classifier
- AnswerClassificationResultObjectFactory.js @jervis446 #4305
- ClassifierObjectFactory.js @jervis446 #4305
- PredictionResultObjectFactory.ts @marianazangrossi
- domain/classroom
- E - Yclassroom-backend-api.service.ts @krishnarao22
- domain/collection
- CollectionRightsBackendApiService.ts @marianazangrossi
- CollectionRightsObjectFactory.ts @marianazangrossi
- CollectionValidationService.ts @marianazangrossi
- domain/creator_dashboard
- CreatorDashboardBackendApiService.ts @marianazangrossi
- domain/exploration
- AnswerStatsObjectFactory.ts @marianazangrossi
- ExplorationObjectFactory.ts @marianazangrossi
- HintObjectFactory.js @YashJipkate
- InteractionObjectFactory.js @YashJipkate
- OutcomeObjectFactory.js @abhaygupta97
- ParamChangeObjectFactory.ts @marianazangrossi
- ParamChangesObjectFactory.ts - @lakshay-angrish
- ParamSpecObjectFactory.ts @marianazangrossi
- ParamSpecsObjectFactory.ts @marianazangrossi
- RuleObjectFactory.ts @abhayraghuwanshi
- SolutionObjectFactory.ts @marianazangrossi
- TriggerObjectFactory.js @17bcs029 (removed the file)
- WrittenTranslationsObjectFactory.ts @marianazangrossi
- domain/learner_dashboard
- LearnerDashboardActivityIdsObjectFactory @marianazangrossi
- LearnerDashboardBackendApiService.js @nithusha21 @marianazangrossi
- LearnerDashboardIdsBackendApiService.js @nithusha21 @marianazangrossi
- LearnerPlaylistService.js @nithusha21 #4135
- domain/objects
- UnitsObjectFactory.ts - @felicityzhao99
- domain/question
- EditableQuestionBackendApiService.ts @marianazangrossi
- QuestionBackendApiService.ts @jimbyo
- QuestionObjectFactory.ts @jimbyo
- domain/sidebar @WickedBrat #4520
- SidebarStatusService.js
- domain/skill
- ConceptCardBackendApiService.ts @marianazangrossi
- EditableSkillBackendApiService.ts @marianazangrossi
- MisconceptionObjectFactory.ts @marianazangrossi
- SkillRightsObjectFactory.ts @marianazangrossi
- SkillRightsBackendApiService.ts @marianazangrossi
- domain/state
- StateObjectFactory.ts @marianazangrossi
- domain/statistics
- FeedbackImprovementTaskObjectFactory.ts @marianazangrossi
- PlaythroughImprovementTaskObjectFactory.ts @marianazangrossi
- SuggestionImprovementTaskObjectFactory.ts @marianazangrossi
- domain/suggestion
- SuggestionThreadObjectFactory.ts @marianazangrossi
- domain/summary
- ExplorationSummaryBackendApiService.ts @marianazangrossi
- domain/topic
- EditableTopicBackendApiService.ts @marianazangrossi
- TopicRightsBackendApiService.ts @marianazangrossi
- TopicRightsObjectFactory.ts @marianazangrossi
- domain/user
- UserInfoObjectFactory.ts
- domain/utilities
- AudioLanguageObjectFactory.js @hoangviet1993
- AutogeneratedAudioLanguageObjectFactory.js @hoangviet1993
- BrowserCheckerService.ts @marianazangrossi
- pages/creator_dashboard
- SuggestionModalForCreatorViewService.ts @marianazangrossi
- pages/exploration_editor
- AnswerGroupsCacheService.js @vinitamurthi
- AutosaveInfoModalService.ts @marianazangrossi
- ChangesInHumanReadableFormService.ts @marianazangrossi
- CompareVersionService.ts @marianazangrossi
- EditorFirstTimeEventsService.ts @marianazangrossi
- E - N exploration-category.service.ts @safwan20
- ExplorationCorrectnessFeedbackService.ts @marianazangrossi
- ExplorationDataService.ts @marianazangrossi
- ExplorationPropertyService.ts @marianazangrossi
- ExplorationRightsService.ts @marianazangrossi
- E - N exploration-tags.service.ts @safwan20
- ExplorationWarningsService.ts @marianazangrossi
- GraphDataService.ts @marianazangrossi
- InteractionDetailsCacheService.js @vinitamurthi
- ImprovementModalService.ts @marianazangrossi
- LearnerAnswerDetailsDataService.ts @marianazangrossi
- ParameterMetadataService.ts @marianazangrossi
- ResponsesService.ts @marianazangrossi
- RouterService.ts @marianazangrossi
- SolutionVerificationService.ts @marianazangrossi
- ThreadDataService.ts @marianazangrossi
- ThreadStatusDisplayService.js @paroothisumit #4606
- TranslationLanguageService.ts @marianazangrossi
- UserEmailPreferencesService.ts @Arnesh07 pages/exploration_player
- AudioTranslationLanguageService.ts @marianazangrossi
- HitsAndSolutionManager.service.ts @marianazangrossi
- ImagePreloaderService.ts @marianazangrossi
- StateClassifierMappingService.ts @marianazangrossi pages/skill_editor
- SkillEditorRoutingService.ts @marianazangrossi
- services
- AlertsService.ts @marianazangrossi
- AssetsBackendApiService.ts @marianazangrossi
- AutoplayedVideosService.js @proishan11 #4805
- BackgroundMaskService.js @aks681
- CodeNormalizerService.ts @marianazangrossi
- ConstructTranslationIdsService.ts @marianazangrossi
- EditabilityServices.js @square-1111
- E - N exploration-features.service.ts @abhayraghuwanshi
- IdGenerationService.js @lilithxxx
- DateTimeFormatService.ts @marianazangrossi
- DebouncerService.ts @marianazangrossi
- DeviceInfoService.ts @marianazangrossi
- DocumentAttributeCustomizationService.ts @marianazangrossi
- ExtensionTagAssemblerService.ts @marianazangrossi
- FocusManagerService.js @aks681
- LocalStorageService.ts @marianazangrossi
- LoggerService.ts @marianazangrossi
- MetaTagCustomizationService.ts @marianazangrossi
- NavigationService.ts @marianazangrossi
- NestedDirectivesRecursionTimeoutPreventionService.ts @marianazangrossi
- PageTitleService.ts @marianazangrossi
- PlayerPositionService.js @ujjwalgulecha
- PlaythroughIssuesBackendApiService.ts @marianazangrossi
- PlaythroughIssuesService.ts @marianazangrossi
- QuestionsListService.ts @marianazangrossi
- RteHelperService.ts @marianazangrossi
- SchemaDefaultValueService.ts @marianazangrossi
- SchemaUndefinedLastElementService.ts @marianazangrossi
- SearchService.ts @marianazangrossi
- SiteAnalyticsService.ts @marianazangrossi
- SpeechSynthesisChunkerService.ts @marianazangrossi
- SuggestionModalService.ts @marianazangrossi
- TrainingDataEditorPainelService.ts @marianazangrossi
- TrainingModalService.ts @marianazangrossi
- UrlService.ts @marianazangrossi
- UserService.ts @marianazangrossi
- ValidatorsService.ts @marianazangrossi
- WindowDimensionsService.ts @marianazangrossi
- WindowRefService.ts @marianazangrossi
- components/ratings
- E - Y rating-computation.service.ts @laujamie
- domain/editor
- M - N base-undo-redo.service.ts
- E - N question-undo-redo.service.ts @safwan20
- domain/exploration
- domain/feedback_thread
- M - Y FeedbackThreadSummaryObjectFactory.ts
- domain/objects
- H - Y NumberWithUnitsObjectFactory.ts Other services:
- E - N collection-creation.service.ts @Hadyn
- E - N exploration-embed-button.service.ts
- E - N question-creation.service.ts @mhotiger
- E - N state-content.service.ts @safwan20
- E - N state-customization-args.service.ts @safwan20
- E - N state-interaction-id.service.ts @safwan20
- E - N state-recorded-voiceovers.service.ts @safwan20
- E - N state-solicit-answer-details.service.ts @safwan20
- E - N state-solution.service.ts @safwan20
- E - N state-written-translations.service.ts @safwan20
- M - Y ConceptCardObjectFactory.ts
- E - Y SkillDifficultyObjectFactory.ts @tianqi-wu
- domain/statistics
- E - Y learner-answer-details-backend-api.service.ts @arpit1912
- domain/story_viewer
- E - Y story-viewer-backend-api.service.ts @EricZLou
- H - Y topic-update.service.ts @shavavo
- E - N AudioFileObjectFactory.ts @safwan20
- E - N FileDownloadRequestObjectFactory.ts @safwan20
- E - N ImageFileObjectFactory.ts @safwan20
- H - Y expression-syntax-tree.service.ts @mertdeg2
- E - Y expression-type-parser.service.ts
- M - Y collection-editor-state.service.ts
- E - N question-suggestion.service.ts
- E - N exploration-automatic-text-to-speech.service.ts @safwan20
- E - N exploration-init-state-name.service.ts
- E - N exploration-language-code.service.ts
- E - N exploration-objective.service.ts
- E - N exploration-param-changes.service.ts @safwan20
- E - N exploration-param-specs.service.ts @safwan20
- E - N exploration-title.service.ts
- E - Y state-improvement-suggestion.service.ts
- E - Y player-position.service.ts @tianqi-wu
- E - Y prediction-algorithm-registry.service.ts @rriyaldhi
- E - N suggestion-modal-for-learner-dashboard.service.ts @hulyak
- TopicEditorRoutingService.ts @amanbora
- E - N compute-graph.service.ts
- E - Y improvement-task.service.ts
- H - Y playthrough.service.ts
- E - N pencil-code-editor-validation.service.ts @safwan20
Note: For a guide on how to access Oppia’s webpages, see this.
Issue Analytics
- State:
- Created 6 years ago
- Comments:313 (272 by maintainers)
Top GitHub Comments
@Nisarg-Chaudhari done!
@LakmaNeha the people I talked to said they see this occasionally, but it’s intermittent for them. They didn’t have a solution. If you want to get the VScode linter working, you could ask on oppia-dev to see if someone has a solution. Alternatively, you could ignore the VScode lint errors and run the linter manually instead with
scripts/linters/pre_commit_linter.py