Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
8977cab7
Commit
8977cab7
authored
7 years ago
by
Atte Keinänen
Browse files
Options
Downloads
Patches
Plain Diff
Fix failing lib/redux tests, fix lint errors
parent
5055a23d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/metabase/containers/EntitySearch.jsx
+0
-1
0 additions, 1 deletion
frontend/src/metabase/containers/EntitySearch.jsx
frontend/test/lib/redux.unit.spec.js
+13
-15
13 additions, 15 deletions
frontend/test/lib/redux.unit.spec.js
with
13 additions
and
16 deletions
frontend/src/metabase/containers/EntitySearch.jsx
+
0
−
1
View file @
8977cab7
...
...
@@ -6,7 +6,6 @@ import cx from "classnames";
import
SearchHeader
from
"
metabase/components/SearchHeader
"
;
import
type
{
LocationDescriptor
}
from
"
metabase/meta/types
"
;
import
{
caseInsensitiveSearch
}
from
"
metabase/lib/string
"
;
import
Icon
from
"
metabase/components/Icon
"
;
import
EmptyState
from
"
metabase/components/EmptyState
"
;
...
...
This diff is collapsed.
Click to expand it.
frontend/test/lib/redux.unit.spec.js
+
13
−
15
View file @
8977cab7
...
...
@@ -3,6 +3,8 @@ import {
updateData
}
from
'
metabase/lib/redux
'
;
import
{
delay
}
from
"
metabase/lib/promise
"
describe
(
"
Metadata
"
,
()
=>
{
const
getDefaultArgs
=
({
existingData
=
'
data
'
,
...
...
@@ -17,7 +19,7 @@ describe("Metadata", () => {
requestStatePath
=
statePath
,
existingStatePath
=
statePath
,
getState
=
()
=>
({
requests
:
{
test
:
{
path
:
{
fetch
:
requestState
,
update
:
requestState
}
}
},
requests
:
{
states
:
{
test
:
{
path
:
{
fetch
:
requestState
,
update
:
requestState
}
}
}
},
test
:
{
path
:
existingData
}
}),
dispatch
=
jasmine
.
createSpy
(
'
dispatch
'
),
...
...
@@ -39,15 +41,15 @@ describe("Metadata", () => {
const
args
=
getDefaultArgs
({});
describe
(
"
fetchData()
"
,
()
=>
{
it
(
"
should return new data if request hasn't been made
"
,
async
(
done
)
=>
{
it
(
"
should return new data if request hasn't been made
"
,
async
()
=>
{
const
argsDefault
=
getDefaultArgs
({});
const
data
=
await
fetchData
(
argsDefault
);
await
delay
(
10
);
expect
(
argsDefault
.
dispatch
.
calls
.
count
()).
toEqual
(
2
);
expect
(
data
).
toEqual
(
args
.
newData
);
done
();
});
it
(
"
should return existing data if request has been made
"
,
async
(
done
)
=>
{
it
(
"
should return existing data if request has been made
"
,
async
()
=>
{
const
argsLoading
=
getDefaultArgs
({
requestState
:
args
.
requestStateLoading
});
const
dataLoading
=
await
fetchData
(
argsLoading
);
expect
(
argsLoading
.
dispatch
.
calls
.
count
()).
toEqual
(
0
);
...
...
@@ -57,21 +59,20 @@ describe("Metadata", () => {
const
dataLoaded
=
await
fetchData
(
argsLoaded
);
expect
(
argsLoaded
.
dispatch
.
calls
.
count
()).
toEqual
(
0
);
expect
(
dataLoaded
).
toEqual
(
args
.
existingData
);
done
();
});
it
(
"
should return new data if previous request ended in error
"
,
async
(
done
)
=>
{
it
(
"
should return new data if previous request ended in error
"
,
async
()
=>
{
const
argsError
=
getDefaultArgs
({
requestState
:
args
.
requestStateError
});
const
dataError
=
await
fetchData
(
argsError
);
await
delay
(
10
);
expect
(
argsError
.
dispatch
.
calls
.
count
()).
toEqual
(
2
);
expect
(
dataError
).
toEqual
(
args
.
newData
);
done
();
});
// FIXME: this seems to make jasmine ignore the rest of the tests
// is an exception bubbling up from fetchData? why?
// how else to test return value in the catch case?
x
it
(
"
should return existing data if request fails
"
,
async
(
done
)
=>
{
it
(
"
should return existing data if request fails
"
,
async
()
=>
{
const
argsFail
=
getDefaultArgs
({
getData
:
()
=>
Promise
.
reject
(
'
error
'
)});
try
{
...
...
@@ -82,12 +83,11 @@ describe("Metadata", () => {
catch
(
error
)
{
return
;
}
done
();
});
});
describe
(
"
updateData()
"
,
()
=>
{
it
(
"
should return new data regardless of previous request state
"
,
async
(
done
)
=>
{
it
(
"
should return new data regardless of previous request state
"
,
async
()
=>
{
const
argsDefault
=
getDefaultArgs
({});
const
data
=
await
updateData
(
argsDefault
);
expect
(
argsDefault
.
dispatch
.
calls
.
count
()).
toEqual
(
2
);
...
...
@@ -107,16 +107,14 @@ describe("Metadata", () => {
const
dataError
=
await
updateData
(
argsError
);
expect
(
argsError
.
dispatch
.
calls
.
count
()).
toEqual
(
2
);
expect
(
dataError
).
toEqual
(
args
.
newData
);
done
();
});
// FIXME: same problem as fetchData() case
xit
(
"
should return existing data if request fails
"
,
async
(
done
)
=>
{
it
(
"
should return existing data if request fails
"
,
async
()
=>
{
const
argsFail
=
getDefaultArgs
({
putData
:
()
=>
{
throw
new
Error
(
'
test
'
)}});
const
data
=
await
fetchData
(
argsFail
);
const
data
=
await
updateData
(
argsFail
);
await
delay
(
10
)
expect
(
argsFail
.
dispatch
.
calls
.
count
()).
toEqual
(
2
);
expect
(
data
).
toEqual
(
args
.
existingData
);
done
();
});
});
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment