Spike: eHoldings - Investigate areas that need refactoring for Jest + RTL testing

Spike: eHoldings - Investigate areas that need refactoring for Jest + RTL testing

UIEH-980: Spike: eHoldings - Investigate areas that need refactoring for Jest + RTL testingClosed

Goal: provide clarity of what parts of ui-eholdings module need to be refactored for an easier migration to Jest+RTL + suggest order in which components will be tested

Results of @Владислав Велицкий review of ui-eholdings code in scope of UIEH-980: Spike: eHoldings - Investigate areas that need refactoring for Jest + RTL testingClosed

Overview

During replacement proposed to create new test branch where team would write tests on jest library. After completing bigtest test would be removed.

Module has a lot of components, utils, hooks, redux support files which needed to be tested. It needs to create complex stories. There are list of all components below which must be tested. Complexity means that 1 is easy to use component and 3 is hard and need more time to test it.

Tests for actions, epic, reducers would be replaced quickly because libraries had same flow. Just need to move, for example: to.be.equal() => .toEqual()

Components from other libraries should be written in __mock__ folder. There are some of them presented here.

Information about Usage Consolidation feature was not included to this PR because this feature isn't available on master branch and all tests for it could be made in a scope of one task after merging

Components which should be refactored

Component

Description

Сomplexity

Test status

Preliminary component test estimation

Estimation grouped

Component

Description

Сomplexity

Test status

Preliminary component test estimation

Estimation grouped

AccessTypeDisplay

-

1

✔️

 

 

AccessTypeEditSection

-

1

-

1

 

AccessTypeSelect

-

1

-

1

 

CustomLabelEditSection

-

1

-

1

 

CustomLabelShowSection

-

1

-

1

 

AccordionListHeader

suggestions:
- move it so separate folder
- move constants to constants folder
- check propTypes

1

-

1

 

 

 

 

 

 

3

DetailsViewSection

-

1

-

1

 

ApiLimitExceededErrorScreen

-

1

-

1

 

FailedBackendErrorScreen

-

1

-

1

 

InvalidBackendErrorScreen

-

1

-

1

 

NoBackendErrorScreen

-

1

-

1

 

UserNotAssignedToKbErrorScreen

-

1

-

1

 

ExternalLink

-

1

-

1

 

HiddenLabel

-

1

-

1

 

KeyValueColumns

-

1

-

1

 

List

-

1

-

1

 

NoResultMessage

-

1

-

1

 

PackageContentTypeField

-

1

-

1

 

PackageNameField

-

1

-

1

 

 

 

 

 

 

3

PackageEdit

-

1

-

1

 

ProxySelectField

-

1

-

1

 

QueryNotFound

-

1

-

1

 

CustomUrlFields

There are two same components - in resource and in title pages. Can remove code duplication

1

-

1

 

SearchBadge

-

1

-

1

 

 

 

 

 

 

3

SearchPackageListItem

-

1

-

1

 

RootProxySelectField

-

1

-

1

 

TagsLabel

-

1

-

1

 

AddTitleToPackage

-

1

-

1

 

 

 

 

 

 

3

CustomUrlFields

-

1

-

1

 

DescriptionField

-

1

-

1

 

EditionField

-

1

-

1

 

TitleNameField

-

1

-

1

 

PackageSelectField

-

1

-

1

 

 

 

 

 

 

3

PeerReviewedField

-

1

-

1

 

PublicationTypeField

-

1

-

1

 

PublisherNameField

-

1

-

1

 

TitleListItem

-

1

-

1

 

Toast

-

1

-

1

 

 

 

 

 

 

3

Toaster

-

1

-

1

 

ToggleSwitch

the component has not been used, it is necessary to check whether it can be removed

1

-

1

 

TokenField

-

1

-

1

 

ContributorsList

-

1

-

1

 

IdentifiersList

-

1

-

1

 

 

 

 

 

 

3

InternalLink

-

1

-

1

 

ProxyDisplay

-

1

-

1

 

shouldFocus

-

1

-

1

 

TokenDisplay

-

1

-

1

 

EHoldings