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
4dc498cf
Unverified
Commit
4dc498cf
authored
4 years ago
by
Jessica DeWitt
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
deleted question.e2e.spec.js (#13007)
parent
5f358727
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/test/metabase-lib/lib/Question.e2e.spec.js
+0
-85
0 additions, 85 deletions
frontend/test/metabase-lib/lib/Question.e2e.spec.js
with
0 additions
and
85 deletions
frontend/test/metabase-lib/lib/Question.e2e.spec.js
deleted
100644 → 0
+
0
−
85
View file @
5f358727
import
{
SAMPLE_DATASET
,
ORDERS
,
metadata
,
}
from
"
__support__/sample_dataset_fixture
"
;
import
Question
from
"
metabase-lib/lib/Question
"
;
import
{
useSharedAdminLogin
}
from
"
__support__/e2e
"
;
import
{
NATIVE_QUERY_TEMPLATE
}
from
"
metabase-lib/lib/queries/NativeQuery
"
;
// TODO Atte Keinänen 6/22/17: This could include tests that run each "question drill action" (summarize etc)
// and check that the result is correct
describe
(
"
Question
"
,
()
=>
{
beforeAll
(
async
()
=>
{
useSharedAdminLogin
();
});
describe
(
"
with SQL questions
"
,
()
=>
{
it
(
"
should return correct result with a static template tag parameter
"
,
async
()
=>
{
const
templateTagName
=
"
orderid
"
;
const
templateTagId
=
"
f1cb12ed3-8727-41b6-bbb4-b7ba31884c30
"
;
const
question
=
Question
.
create
({
databaseId
:
SAMPLE_DATASET
.
id
,
tableId
:
ORDERS
.
id
,
metadata
,
}).
setDatasetQuery
({
...
NATIVE_QUERY_TEMPLATE
,
database
:
SAMPLE_DATASET
.
id
,
native
:
{
query
:
`SELECT SUBTOTAL FROM ORDERS WHERE id = {{
${
templateTagName
}
}}`
,
"
template-tags
"
:
{
[
templateTagName
]:
{
id
:
templateTagId
,
name
:
templateTagName
,
display_name
:
"
Order ID
"
,
type
:
"
number
"
,
},
},
},
});
// Without a template tag the query should fail
const
results1
=
await
question
.
apiGetResults
({
ignoreCache
:
true
});
expect
(
results1
[
0
].
status
).
toBe
(
"
failed
"
);
question
.
_parameterValues
=
{
[
templateTagId
]:
"
5
"
};
const
results2
=
await
question
.
apiGetResults
({
ignoreCache
:
true
});
expect
(
results2
[
0
]).
toBeDefined
();
expect
(
results2
[
0
].
data
.
rows
[
0
][
0
]).
toEqual
(
127.88197029833711
);
});
it
(
"
should return correct result with an optional template tag clause
"
,
async
()
=>
{
const
templateTagName
=
"
orderid
"
;
const
templateTagId
=
"
f1cb12ed3-8727-41b6-bbb4-b7ba31884c30
"
;
const
question
=
Question
.
create
({
databaseId
:
SAMPLE_DATASET
.
id
,
tableId
:
ORDERS
.
id
,
metadata
,
}).
setDatasetQuery
({
...
NATIVE_QUERY_TEMPLATE
,
database
:
SAMPLE_DATASET
.
id
,
native
:
{
query
:
`SELECT SUBTOTAL FROM ORDERS [[WHERE id = {{
${
templateTagName
}
}}]]`
,
"
template-tags
"
:
{
[
templateTagName
]:
{
id
:
templateTagId
,
name
:
templateTagName
,
display_name
:
"
Order ID
"
,
type
:
"
number
"
,
},
},
},
});
const
results1
=
await
question
.
apiGetResults
({
ignoreCache
:
true
});
expect
(
results1
[
0
]).
toBeDefined
();
expect
(
results1
[
0
].
data
.
rows
.
length
).
toEqual
(
2000
);
question
.
_parameterValues
=
{
[
templateTagId
]:
"
5
"
};
const
results2
=
await
question
.
apiGetResults
({
ignoreCache
:
true
});
expect
(
results2
[
0
]).
toBeDefined
();
expect
(
results2
[
0
].
data
.
rows
[
0
][
0
]).
toEqual
(
127.88197029833711
);
});
});
});
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