Skip to content

Commit 3d5559d

Browse files
committed
added test for the handling
1 parent 97f8a6a commit 3d5559d

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
describe("query location tests", () => {
2+
3+
// Errors with the correct message should be thrown
4+
it("queryLocation that does not end on rq", () => {
5+
cy.visit("/");
6+
cy.contains("For testing only").click();
7+
cy.contains("Average value - queryLocation without rq").click();
8+
9+
cy.contains("Invalid query location.").should("exist");
10+
});
11+
12+
it("wrong queryLocation that does not exist, correct file ending", () => {
13+
cy.visit("/");
14+
cy.contains("For testing only").click();
15+
cy.contains("Average value - unexisting queryLocation (ends in .rq)").click();
16+
17+
cy.contains("Empty query text. Check your query and location.").should("exist");
18+
});
19+
});
20+

src/dataProvider/SparqlDataProvider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ async function buildQueryText(query) {
113113
throw new Error("Invalid query location.")
114114
}
115115
if (rawText === null || rawText === '' ) {
116-
throw new Error("Empty query text.")
116+
throw new Error("Empty query text. Check your query and location.")
117117
}
118118

119119
if (query.variableValues) {

0 commit comments

Comments
 (0)