-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
40 changed files
with
2,030 additions
and
21 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
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 |
---|---|---|
|
@@ -24,4 +24,7 @@ | |
<Category> | ||
<name>USERSESSION</name> | ||
</Category> | ||
<Category> | ||
<name>PERMALINK</name> | ||
</Category> | ||
</CategoryList> |
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
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 |
---|---|---|
|
@@ -24,4 +24,7 @@ | |
<Category> | ||
<name>USERSESSION</name> | ||
</Category> | ||
<Category> | ||
<name>PERMALINK</name> | ||
</Category> | ||
</CategoryList> |
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,65 @@ | ||
/* | ||
* Copyright 2023, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import expect from "expect"; | ||
|
||
import { | ||
LOAD_PERMALINK, | ||
LOAD_PERMALINK_ERROR, | ||
PERMALINK_LOADED, | ||
LOADING, | ||
RESET, | ||
SAVE_PERMALINK, | ||
UPDATE_SETTINGS, | ||
loadPermalink, | ||
loadPermalinkError, | ||
permalinkLoaded, | ||
permalinkLoading, | ||
resetPermalink, | ||
savePermalink, | ||
updatePermalinkSettings | ||
} from "../permalink"; | ||
|
||
describe("Test correctness of the permalink actions", () => { | ||
it("loadPermalink", () => { | ||
const action = loadPermalink("test"); | ||
expect(action.type).toBe(LOAD_PERMALINK); | ||
expect(action.id).toBe("test"); | ||
}); | ||
it("loadPermalinkError", () => { | ||
const error = {message: "error"}; | ||
const action = loadPermalinkError(error); | ||
expect(action.type).toBe(LOAD_PERMALINK_ERROR); | ||
expect(action.error).toEqual(error); | ||
}); | ||
it("permalinkLoaded", () => { | ||
const action = permalinkLoaded(); | ||
expect(action.type).toBe(PERMALINK_LOADED); | ||
}); | ||
it("permalinkLoading", () => { | ||
const action = permalinkLoading(true); | ||
expect(action.type).toBe(LOADING); | ||
expect(action.loading).toBeTruthy(); | ||
}); | ||
it("resetPermalink", () => { | ||
const action = resetPermalink(); | ||
expect(action.type).toBe(RESET); | ||
}); | ||
it("savePermalink", () => { | ||
const saveObj = {name: "test"}; | ||
const action = savePermalink(saveObj); | ||
expect(action.type).toBe(SAVE_PERMALINK); | ||
expect(action.value).toEqual(saveObj); | ||
}); | ||
it("updatePermalinkSettings", () => { | ||
const settings = {title: "test"}; | ||
const action = updatePermalinkSettings(settings); | ||
expect(action.type).toBe(UPDATE_SETTINGS); | ||
expect(action.settings).toEqual(settings); | ||
}); | ||
}); |
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,80 @@ | ||
/** | ||
* Copyright 2023, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
export const LOAD_PERMALINK = "PERMALINK:LOAD"; | ||
export const PERMALINK_LOADED = "PERMALINK:LOADED"; | ||
export const LOAD_PERMALINK_ERROR = "PERMALINK:LOAD_ERROR"; | ||
export const SAVE_PERMALINK = "PERMALINK:SAVE"; | ||
export const UPDATE_SETTINGS = "PERMALINK:UPDATE_SETTINGS"; | ||
export const LOADING = "PERMALINK:LOADING"; | ||
export const RESET = "PERMALINK:RESET"; | ||
|
||
/** | ||
* Load permalink | ||
* @param {string} id | ||
* @memberof actions.permalink | ||
*/ | ||
export const loadPermalink = (id) => ({ | ||
type: LOAD_PERMALINK, | ||
id | ||
}); | ||
|
||
/** | ||
* Trigger on permalink loaded | ||
* @memberof actions.permalink | ||
*/ | ||
export const permalinkLoaded = () => ({ | ||
type: PERMALINK_LOADED | ||
}); | ||
|
||
/** | ||
* Trigger on permalink load error | ||
* @param {Object} error | ||
* @memberof actions.permalink | ||
*/ | ||
export const loadPermalinkError = (error) => ({ | ||
type: LOAD_PERMALINK_ERROR, | ||
error | ||
}); | ||
|
||
/** | ||
* Trigger on save permalink | ||
* @param {Object} value | ||
* @memberof actions.permalink | ||
*/ | ||
export const savePermalink = (value) => ({ | ||
type: SAVE_PERMALINK, | ||
value | ||
}); | ||
|
||
/** | ||
* Trigger on update permalink settings | ||
* @param {Object} settings | ||
* @memberof actions.permalink | ||
*/ | ||
export const updatePermalinkSettings = (settings) => ({ | ||
type: UPDATE_SETTINGS, | ||
settings | ||
}); | ||
|
||
/** | ||
* Trigger on loading a permalink | ||
* @param {boolean} loading | ||
* @memberof actions.permalink | ||
*/ | ||
export const permalinkLoading = (loading) => ({ | ||
type: LOADING, | ||
loading | ||
}); | ||
|
||
/** | ||
* Trigger on permalink reset | ||
* @memberof actions.permalink | ||
*/ | ||
export const resetPermalink = () => ({ | ||
type: RESET | ||
}); |
Oops, something went wrong.