-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug/FP-896: Fix add definition to list (#342)
* fix add definition to list * add system def list unit test Co-authored-by: Owais Jamil <47395902+owaisj@users.noreply.github.com>
- Loading branch information
1 parent
2d7926d
commit 933860d
Showing
3 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
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
26 changes: 26 additions & 0 deletions
26
client/src/redux/reducers/tests/datafiles.reducers.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,26 @@ | ||
import {systems as datafilesReducer, initialSystemState } from "../datafiles.reducers"; | ||
import systemDefinitionFixture from '../../sagas/fixtures/systemDefinition.fixture'; | ||
|
||
describe("Datafiles Reducer", () => { | ||
test("Load initial state", () => { | ||
expect(datafilesReducer(initialSystemState, { type: undefined })).toEqual( | ||
initialSystemState | ||
); | ||
}); | ||
test("Add system definition to state", () => { | ||
const addSystemDefinitionAction = { | ||
type: "FETCH_SYSTEM_DEFINITION_SUCCESS", | ||
payload: systemDefinitionFixture | ||
}; | ||
expect(datafilesReducer(initialSystemState, addSystemDefinitionAction)).toEqual({ | ||
...initialSystemState, | ||
definitions: { | ||
...initialSystemState.definitions, | ||
list: [systemDefinitionFixture], | ||
error: false, | ||
errorMessage: null, | ||
loading: false | ||
} | ||
}); | ||
}); | ||
}); |
43 changes: 43 additions & 0 deletions
43
client/src/redux/sagas/fixtures/systemDefinition.fixture.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,43 @@ | ||
const systemDefinitionFixture = { | ||
owner: 'wma_prtl', | ||
_links: { | ||
owner: { href: 'https://portals-api.tacc.utexas.edu/profiles/v2/wma_prtl' }, | ||
metadata: { | ||
href: | ||
'https://portals-api.tacc.utexas.edu/meta/v2/data/?q=%7B%22associationIds%22%3A%221843722814843916777-242ac119-0001-006%22%7D' | ||
}, | ||
roles: { | ||
href: | ||
'https://portals-api.tacc.utexas.edu/systems/v2/frontera.home.user/roles' | ||
}, | ||
self: { | ||
href: 'https://portals-api.tacc.utexas.edu/systems/v2/frontera.home.user' | ||
} | ||
}, | ||
available: true, | ||
description: 'Home system for user: user', | ||
storage: { | ||
proxy: null, | ||
protocol: 'SFTP', | ||
mirror: false, | ||
port: 22, | ||
auth: { type: 'SSHKEYS' }, | ||
publicAppsDir: null, | ||
host: 'frontera.tacc.utexas.edu', | ||
rootDir: '/home1/12345/user', | ||
homeDir: '/' | ||
}, | ||
type: 'STORAGE', | ||
uuid: '1843722814843916777-242ac119-0001-006', | ||
revision: 2, | ||
site: 'portal.dev', | ||
default: false, | ||
public: false, | ||
globalDefault: false, | ||
name: 'frontera.home.user', | ||
id: 'frontera.home.user', | ||
lastModified: '2020-08-11T14:37:39-05:00', | ||
status: 'UP' | ||
}; | ||
|
||
export default systemDefinitionFixture; |