Skip to content

Commit

Permalink
EDSC-3773: Some adjustments to the EDSC-3773 merge (#1798)
Browse files Browse the repository at this point in the history
* EDSC-3773:
- Moved out all the logic bocks in buildAccessMethods into their one files (1 for each logic block).
- Created tests for each of those logic blocks and updated the buildAccessMethods to test that those methods get called the correct number of times and with the correct params.

* removed dangling cammas

* EDSC-3773: a bit of cleanup

* EDSC-3773: added some code coverage

* EDSC-3773: updated documentation and how we run buildAccessMethods.

* EDSC-3773: changed lodash to lodash-es

* EDSC-3773: fixed the indexing issue and cleaned up some stuff

* EDSC-3773: fixed harmony tests

* EDSC-3773: addressed matthew's comments

* EDSC-3773: added some comments and pushed a small lint fix

* EDSC-3773: fixed some eslint issues

* fixed some wording

* EDSC-3773: added a test that needs to be finished in buildAccessMethods

* EDSC-3773: fixed up the format and tests of Harmony, Opendap, and Swodlr results to match Esi and Echo Orders

* EDSC-3773: removed console.logs

* EDSC-3773: fixed up syntax/linting so it matches our standards

* EDSC-3773: forgot a couple of the lint changes

* adding test and seeing weirdness

* fixed up the test

* EDSC-3773: merged new test and removed console.logs and fixed the order of checking results so they are accurate to the indexing of echoIndex, esiIndex, & harmonyIndex

* EDSC-3773: split ESI and ECHO ORDERS and updated the way we build the accessMethods in buildAccessMethods such that now we create a list of them and reduce them into a single object.

* small linter fix

* EDSC-3773: addressed some issues brought up by Trevor and added some constants for the accessMethods

* EDSC-3773: added this check to account for serviceItems = null

* EDSC-3773: fixed some tests that had items: null and updated buildAccessMethods to be cleaner

* EDSC-3773: added a check such that we don't push setDataQualitySummaries action when there is an empty set of dqsItems.

* EDSC-3773: fixed up the tests to match the expected results

* forgot to remove a console.log

* EDSC-3773: Added one last test to cover the default switch statement
  • Loading branch information
bnp26 authored Sep 11, 2024
1 parent 64476b5 commit 902b479
Show file tree
Hide file tree
Showing 18 changed files with 1,792 additions and 849 deletions.
8 changes: 4 additions & 4 deletions static/src/js/actions/__tests__/focusedCollection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ describe('getFocusedCollection', () => {
'org.ceos.wgiss.cwic.granules.prod': {}
},
tools: {
items: null
items: []
}
}
}
Expand Down Expand Up @@ -286,7 +286,7 @@ describe('getFocusedCollection', () => {
'org.ceos.wgiss.cwic.granules.prod': {}
},
tools: {
items: null
items: []
}
}
}
Expand Down Expand Up @@ -370,7 +370,7 @@ describe('getFocusedCollection', () => {
}
},
tools: {
items: null
items: []
}
}
}
Expand Down Expand Up @@ -524,7 +524,7 @@ describe('getFocusedCollection', () => {
}
],
tools: {
items: null
items: []
}
}
}
Expand Down
100 changes: 75 additions & 25 deletions static/src/js/actions/__tests__/project.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,24 +287,24 @@ describe('getProjectCollections', () => {
}]
},
services: {
items: null
items: []
},
dataQualitySummaries:
{
items: null
items: []
}
},
{
conceptId: 'collectionId2',
tools: {
items: null
items: []
},
services: {
items: null
items: []
},
dataQualitySummaries:
{
items: null
items: []
}
}]
}
Expand Down Expand Up @@ -350,7 +350,8 @@ describe('getProjectCollections', () => {

const storeActions = store.getActions()

expect(storeActions.length).toEqual(4)
expect(storeActions.length).toEqual(6)

expect(storeActions[0]).toEqual({
type: ADD_ACCESS_METHODS,
payload: {
Expand All @@ -360,6 +361,14 @@ describe('getProjectCollections', () => {
})

expect(storeActions[1]).toEqual({
type: SET_DATA_QUALITY_SUMMARIES,
payload: {
catalogItemId: 'collectionId1',
dataQualitySummaries: []
}
})

expect(storeActions[2]).toEqual({
type: UPDATE_COLLECTION_METADATA,
payload: [
expect.objectContaining({
Expand All @@ -371,15 +380,23 @@ describe('getProjectCollections', () => {
]
})

expect(storeActions[2]).toEqual({
expect(storeActions[3]).toEqual({
type: ADD_ACCESS_METHODS,
payload: {
collectionId: 'collectionId2',
methods: {}
}
})

expect(storeActions[3]).toEqual({
expect(storeActions[4]).toEqual({
type: SET_DATA_QUALITY_SUMMARIES,
payload: {
catalogItemId: 'collectionId2',
dataQualitySummaries: []
}
})

expect(storeActions[5]).toEqual({
type: UPDATE_COLLECTION_METADATA,
payload: [
expect.objectContaining({
Expand Down Expand Up @@ -609,24 +626,24 @@ describe('getProjectCollections', () => {
}]
},
services: {
items: null
items: []
},
dataQualitySummaries:
{
items: null
items: []
}
},
{
conceptId: 'collectionId2',
tools: {
items: null
items: []
},
services: {
items: null
items: []
},
dataQualitySummaries:
{
items: null
items: []
}
}]
}
Expand Down Expand Up @@ -674,7 +691,8 @@ describe('getProjectCollections', () => {

const storeActions = store.getActions()

expect(storeActions.length).toEqual(5)
expect(storeActions.length).toEqual(7)

expect(storeActions[0]).toEqual({
type: ADD_ERROR,
payload: expect.objectContaining({
Expand All @@ -693,6 +711,14 @@ describe('getProjectCollections', () => {
})

expect(storeActions[2]).toEqual({
type: SET_DATA_QUALITY_SUMMARIES,
payload: {
catalogItemId: 'collectionId1',
dataQualitySummaries: []
}
})

expect(storeActions[3]).toEqual({
type: UPDATE_COLLECTION_METADATA,
payload: [
expect.objectContaining({
Expand All @@ -704,15 +730,23 @@ describe('getProjectCollections', () => {
]
})

expect(storeActions[3]).toEqual({
expect(storeActions[4]).toEqual({
type: ADD_ACCESS_METHODS,
payload: {
collectionId: 'collectionId2',
methods: {}
}
})

expect(storeActions[4]).toEqual({
expect(storeActions[5]).toEqual({
type: SET_DATA_QUALITY_SUMMARIES,
payload: {
catalogItemId: 'collectionId2',
dataQualitySummaries: []
}
})

expect(storeActions[6]).toEqual({
type: UPDATE_COLLECTION_METADATA,
payload: [
expect.objectContaining({
Expand Down Expand Up @@ -750,26 +784,26 @@ describe('getProjectCollections', () => {
],
dataQualitySummaries:
{
items: null
items: []
},
tools: {
items: null
items: []
},
services: {
items: null
items: []
}
},
{
conceptId: 'collectionId2',
tools: {
items: null
items: []
},
dataQualitySummaries:
{
items: null
items: []
},
services: {
items: null
items: []
}
}]
}
Expand Down Expand Up @@ -815,7 +849,7 @@ describe('getProjectCollections', () => {

const storeActions = store.getActions()

expect(storeActions.length).toEqual(4)
expect(storeActions.length).toEqual(6)

expect(storeActions[0]).toEqual({
type: ADD_ACCESS_METHODS,
Expand All @@ -826,6 +860,14 @@ describe('getProjectCollections', () => {
})

expect(storeActions[1]).toEqual({
type: SET_DATA_QUALITY_SUMMARIES,
payload: {
catalogItemId: 'collectionId1',
dataQualitySummaries: []
}
})

expect(storeActions[2]).toEqual({
type: UPDATE_COLLECTION_METADATA,
payload: [
expect.objectContaining({
Expand All @@ -837,15 +879,23 @@ describe('getProjectCollections', () => {
]
})

expect(storeActions[2]).toEqual({
expect(storeActions[3]).toEqual({
type: ADD_ACCESS_METHODS,
payload: {
collectionId: 'collectionId2',
methods: {}
}
})

expect(storeActions[3]).toEqual({
expect(storeActions[4]).toEqual({
type: 'SET_DATA_QUALITY_SUMMARIES',
payload: {
catalogItemId: 'collectionId2',
dataQualitySummaries: []
}
})

expect(storeActions[5]).toEqual({
type: UPDATE_COLLECTION_METADATA,
payload: [
expect.objectContaining({
Expand Down
4 changes: 2 additions & 2 deletions static/src/js/components/Map/__tests__/mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ export const updateProps = {
isOpenSearch: false,
services: {
count: 0,
items: null
items: []
},
shortName: 'MOD13Q1',
tags: {
Expand Down Expand Up @@ -983,7 +983,7 @@ export const updateProps = {
title: 'MODIS/Terra Vegetation Indices 16-Day L3 Global 250m SIN Grid V006',
variables: {
count: 0,
items: null
items: []
},
versionId: '006',
gibsLayers: 'Geographic',
Expand Down
5 changes: 5 additions & 0 deletions static/src/js/constants/accessMethodTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const ECHO_ORDERS = 'echoOrders'
export const ESI = 'esi'
export const OPENDAP = 'opendap'
export const HARMONY = 'harmony'
export const SWODLR = 'swodlr'
Loading

0 comments on commit 902b479

Please sign in to comment.