Skip to content
Snippets Groups Projects

Resolve MIN-57 "Feature/ connect drug search query"

Merged Resolve MIN-57 "Feature/ connect drug search query"
3 unresolved threads
Merged Tadeusz Miesiąc requested to merge feature/MIN-57-connect-drug-search-query into development
3 unresolved threads

Description

Introduced fetching for drugs query

Things done

  • fetching
  • saving to redux store under 'drugs'
  • initialised integrational testing for redux
  • introduced axios mock library
  • introduced utility functions for mocking axios
  • introduced utility library for zod fixtures

Main idea behind testing:

Atm I see two cases for testing redux store and the logic inside

  • testing async calls and thunks to make sure that validation of the data is there
  • testing asserting data to the store and manipulating it. Atm it's not complex -> but It will

Pay attention for:

  • missing unit test for rest of the functions Already done
  • utility function for reseting function store should be moved to abstraction Already done
  • store has to be reseted before each test because it's not a mock function -> that's why utility function was created
Edited by Tadeusz Miesiąc

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • mateuszmiko resolved all threads

    resolved all threads

  • mateuszmiko mentioned in merge request !22 (merged)

    mentioned in merge request !22 (merged)

  • 1 export const PROJECT_ID = 'pd_map_winter_23';
  • 1 import { z } from 'zod';
    2
    3 export const referenceSchema = z.object({
    4 link: z.string(),
    5 article: z
  • 1 import { ActionReducerMapBuilder } from '@reduxjs/toolkit';
    2 import { DrugsState } from './drugs.types';
    3 import { getDrugs } from './drugs.thunks';
    4
    5 export const getDrugsReducer = (builder: ActionReducerMapBuilder<DrugsState>): void => {
    6 builder.addCase(getDrugs.pending, state => {
    7 state.loading = 'pending';
    8 });
    9 builder.addCase(getDrugs.fulfilled, (state, action) => {
    10 state.data = action.payload;
    11 state.loading = 'succeeded';
    12 });
    13 builder.addCase(getDrugs.rejected, state => {
    14 state.loading = 'failed';
    15 // TODO to discuss manage state of failure
  • LGTM but there's place for improvements

  • Adrian Orłów approved this merge request

    approved this merge request

  • Tadeusz Miesiąc added 3 commits

    added 3 commits

    • f8a69f07 - feat(drugs tests): replaced constants with axios http response
    • 910a7266 - refactor(reference schema): extracted article to separate schema
    • 39d79916 - refactor(get drugs string with query param): moved repeated string to separate function

    Compare with previous version

  • added 1 commit

    • 62df5565 - refactor(fetch data state type): moved fetching state to abstraction cuz it's repeated few times

    Compare with previous version

  • Tadeusz Miesiąc added 9 commits

    added 9 commits

    Compare with previous version

  • added 1 commit

    • 90f6a4fb - Merge branch 'development' into feature/MIN-57-connect-drug-search-query

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Tadeusz Miesiąc enabled an automatic merge when the pipeline for f40b81bf succeeds

    enabled an automatic merge when the pipeline for f40b81bf succeeds

  • Tadeusz Miesiąc mentioned in commit bcdd750b

    mentioned in commit bcdd750b

  • Adrian Orłów mentioned in merge request !24 (merged)

    mentioned in merge request !24 (merged)

  • Please register or sign in to reply
    Loading