[js-testing] add tests for explore actions (#2976)

* move to explore folder and delete explorev2 folder

* add tests for fetchDatasourceMetadata

* tests for fetchDatasources, fetchDatasourceMetadata

* use $.ajax for fetch dashboards and write test
This commit is contained in:
Alanna Scott
2017-06-15 12:26:22 -07:00
committed by GitHub
parent 8329ea2b9b
commit 00b34d7fbd
4 changed files with 194 additions and 43 deletions

View File

@@ -194,16 +194,19 @@ export function fetchDashboardsFailed(userId) {
export function fetchDashboards(userId) {
return function (dispatch) {
const url = '/dashboardmodelviewasync/api/read?_flt_0_owners=' + userId;
$.get(url, function (data, status) {
if (status === 'success') {
$.ajax({
type: 'GET',
url,
success: (data) => {
const choices = [];
for (let i = 0; i < data.pks.length; i++) {
choices.push({ value: data.pks[i], label: data.result[i].dashboard_title });
}
dispatch(fetchDashboardsSucceeded(choices));
} else {
},
error: () => {
dispatch(fetchDashboardsFailed(userId));
}
},
});
};
}