forked from geosolutions-it/geonode-mapstore-client
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retrieve resurce status from backend instead of caching it inside loc…
…al storage (#834)
- Loading branch information
1 parent
12a6b73
commit 092832f
Showing
9 changed files
with
129 additions
and
70 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
57 changes: 57 additions & 0 deletions
57
geonode_mapstore_client/client/js/epics/__tests__/resourceservice-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,57 @@ | ||
/* | ||
* Copyright 2022, 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 MockAdapter from 'axios-mock-adapter'; | ||
import axios from '@mapstore/framework/libs/ajax'; | ||
import { testEpic } from '@mapstore/framework/epics/__tests__/epicTestUtils'; | ||
import { | ||
STOP_ASYNC_PROCESS, | ||
startAsyncProcess | ||
} from '@js/actions/resourceservice'; | ||
import { gnMonitorAsyncProcesses } from '../resourceservice'; | ||
|
||
let mockAxios; | ||
|
||
describe('resourceservice epics', () => { | ||
beforeEach(done => { | ||
global.__DEVTOOLS__ = true; | ||
mockAxios = new MockAdapter(axios); | ||
setTimeout(done); | ||
}); | ||
afterEach(done => { | ||
delete global.__DEVTOOLS__; | ||
mockAxios.restore(); | ||
setTimeout(done); | ||
}); | ||
|
||
it('test gnMonitorAsyncProcesses', (done) => { | ||
const testState = { | ||
resourceservice: {} | ||
}; | ||
const actionsCount = 1; | ||
mockAxios.onGet().reply(() => [200, { status: 'finished' }]); | ||
testEpic( | ||
gnMonitorAsyncProcesses, | ||
actionsCount, | ||
startAsyncProcess({ output: {status_url: 'test'}, resource: { pk: 1, name: 'test resource' }, processType: 'test process' }), | ||
(actions) => { | ||
try { | ||
expect(actions.map(({ type }) => type)) | ||
.toEqual([ | ||
STOP_ASYNC_PROCESS | ||
]); | ||
} catch (e) { | ||
done(e); | ||
} | ||
done(); | ||
}, | ||
testState | ||
); | ||
}); | ||
}); |
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
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
24 changes: 24 additions & 0 deletions
24
geonode_mapstore_client/client/js/selectors/__tests__/resourceservice-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,24 @@ | ||
/* | ||
* Copyright 2022, 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 { getCurrentProcesses } from '../resourceservice'; | ||
|
||
const testState = { | ||
resourceservice: { | ||
processes: [{ name: 'test process' }] | ||
} | ||
}; | ||
|
||
describe('resourceservice selector', () => { | ||
|
||
it('test getCurrentProcesses', () => { | ||
expect(getCurrentProcesses(testState)).toEqual([{ name: 'test process' }]); | ||
}); | ||
|
||
}); |
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
31 changes: 0 additions & 31 deletions
31
geonode_mapstore_client/client/js/utils/LocalStorageUtils.js
This file was deleted.
Oops, something went wrong.