-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EDSC-3773: Refactor buildAccessMethods.js (#1767)
* 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
- Loading branch information
Showing
12 changed files
with
5,502 additions
and
1,718 deletions.
There are no files selected for viewing
5,138 changes: 3,603 additions & 1,535 deletions
5,138
static/src/js/util/accessMethods/__tests__/buildAccessMethods.test.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
static/src/js/util/accessMethods/buildAccessMethods/__tests__/buildDownload.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { buildDownload } from '../buildDownload' | ||
|
||
describe('buildDownload', () => { | ||
test('returns a download access method', () => { | ||
const collectionMetadata = { | ||
granules: { | ||
items: [{ | ||
online_access_flag: true | ||
}] | ||
} | ||
} | ||
const isOpenSearch = false | ||
|
||
const { | ||
granules | ||
} = collectionMetadata | ||
|
||
const method = buildDownload(granules, isOpenSearch) | ||
|
||
expect(method).toEqual( | ||
{ | ||
download: { | ||
isValid: true, | ||
type: 'download' | ||
} | ||
} | ||
) | ||
}) | ||
|
||
test('returns a download access method for open search', () => { | ||
const collectionMetadata = {} | ||
const isOpenSearch = true | ||
|
||
const { | ||
granules = {} | ||
} = collectionMetadata | ||
|
||
const method = buildDownload(granules, isOpenSearch) | ||
|
||
expect(method).toEqual( | ||
{ | ||
download: { | ||
isValid: true, | ||
type: 'download' | ||
} | ||
} | ||
) | ||
}) | ||
}) |
Oops, something went wrong.