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
acce8baf
Commit
acce8baf
authored
6 years ago
by
Tom Robinson
Browse files
Options
Downloads
Patches
Plain Diff
Fix metrics/segmentsi test
parent
d59a9cd4
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/test/reference/metrics.integ.spec.js
+19
-8
19 additions, 8 deletions
frontend/test/reference/metrics.integ.spec.js
frontend/test/reference/segments.integ.spec.js
+9
-1
9 additions, 1 deletion
frontend/test/reference/segments.integ.spec.js
with
28 additions
and
9 deletions
frontend/test/reference/metrics.integ.spec.js
+
19
−
8
View file @
acce8baf
...
...
@@ -5,6 +5,7 @@ import {
import
React
from
"
react
"
;
import
{
mount
}
from
"
enzyme
"
;
import
{
assocIn
}
from
"
icepick
"
;
import
{
CardApi
,
MetricApi
}
from
"
metabase/services
"
;
...
...
@@ -21,6 +22,8 @@ import MetricDetailContainer from "metabase/reference/metrics/MetricDetailContai
import
MetricQuestionsContainer
from
"
metabase/reference/metrics/MetricQuestionsContainer
"
;
import
MetricRevisionsContainer
from
"
metabase/reference/metrics/MetricRevisionsContainer
"
;
// NOTE: database/table_id/source_table are hard-coded, this might be a problem at some point
describe
(
"
The Reference Section
"
,
()
=>
{
// Test data
const
metricDef
=
{
...
...
@@ -28,7 +31,7 @@ describe("The Reference Section", () => {
description
:
"
I did it!
"
,
table_id
:
1
,
show_in_getting_started
:
true
,
definition
:
{
database
:
1
,
query
:
{
aggregation
:
[
"
count
"
]
}
},
definition
:
{
database
:
1
,
query
:
{
aggregation
:
[
[
"
count
"
]
]
}
},
};
const
anotherMetricDef
=
{
...
...
@@ -36,7 +39,7 @@ describe("The Reference Section", () => {
description
:
"
I did it again!
"
,
table_id
:
1
,
show_in_getting_started
:
true
,
definition
:
{
database
:
1
,
query
:
{
aggregation
:
[
"
count
"
]
}
},
definition
:
{
database
:
1
,
query
:
{
aggregation
:
[
[
"
count
"
]
]
}
},
};
const
metricCardDef
=
{
...
...
@@ -46,7 +49,7 @@ describe("The Reference Section", () => {
database
:
1
,
table_id
:
1
,
type
:
"
query
"
,
query
:
{
source_table
:
1
,
aggregation
:
[
"
metric
"
,
1
]
},
query
:
{
source_table
:
1
,
aggregation
:
[
[
"
metric
"
,
1
]
]
},
},
visualization_settings
:
{},
};
...
...
@@ -116,10 +119,16 @@ describe("The Reference Section", () => {
});
it
(
"
Should see a newly asked question in its questions list
"
,
async
()
=>
{
let
card
=
await
CardApi
.
create
(
metricCardDef
);
expect
(
card
.
name
).
toBe
(
metricCardDef
.
name
);
let
card
;
try
{
const
cardDef
=
assocIn
(
metricCardDef
,
[
"
dataset_query
"
,
"
query
"
,
"
aggregation
"
,
0
,
1
],
metricIds
[
0
],
);
card
=
await
CardApi
.
create
(
cardDef
);
expect
(
card
.
name
).
toBe
(
metricCardDef
.
name
);
// see that there is a new question on the metric's questions page
const
store
=
await
createTestStore
();
...
...
@@ -127,8 +136,10 @@ describe("The Reference Section", () => {
mount
(
store
.
connectContainer
(
<
MetricQuestionsContainer
/>
));
await
store
.
waitForActions
([
FETCH_METRICS
,
FETCH_METRIC_TABLE
]);
}
finally
{
// even if the code above results in an exception, try to delete the question
await
CardApi
.
delete
({
cardId
:
card
.
id
});
if
(
card
)
{
// even if the code above results in an exception, try to delete the question
await
CardApi
.
delete
({
cardId
:
card
.
id
});
}
}
});
});
...
...
This diff is collapsed.
Click to expand it.
frontend/test/reference/segments.integ.spec.js
+
9
−
1
View file @
acce8baf
...
...
@@ -5,6 +5,7 @@ import {
import
React
from
"
react
"
;
import
{
mount
}
from
"
enzyme
"
;
import
{
assocIn
}
from
"
icepick
"
;
import
{
CardApi
,
SegmentApi
}
from
"
metabase/services
"
;
...
...
@@ -24,6 +25,8 @@ import SegmentRevisionsContainer from "metabase/reference/segments/SegmentRevisi
import
SegmentFieldListContainer
from
"
metabase/reference/segments/SegmentFieldListContainer
"
;
import
SegmentFieldDetailContainer
from
"
metabase/reference/segments/SegmentFieldDetailContainer
"
;
// NOTE: database/table_id/source_table are hard-coded, this might be a problem at some point
describe
(
"
The Reference Section
"
,
()
=>
{
// Test data
const
segmentDef
=
{
...
...
@@ -154,7 +157,12 @@ describe("The Reference Section", () => {
});
it
(
"
Should see a newly asked question in its questions list
"
,
async
()
=>
{
let
card
=
await
CardApi
.
create
(
segmentCardDef
);
const
cardDef
=
assocIn
(
segmentCardDef
,
[
"
dataset_query
"
,
"
query
"
,
"
filter
"
,
1
],
segmentIds
[
0
],
);
let
card
=
await
CardApi
.
create
(
cardDef
);
expect
(
card
.
name
).
toBe
(
segmentCardDef
.
name
);
...
...
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