You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@jena.apache.org by GitBox <gi...@apache.org> on 2022/03/11 11:03:45 UTC

[GitHub] [jena] kinow commented on a change in pull request #1222: [JENA-2307] Add e2e tests

kinow commented on a change in pull request #1222:
URL: https://github.com/apache/jena/pull/1222#discussion_r824610028



##########
File path: jena-fuseki2/jena-fuseki-ui/src/services/mock/json-server.js
##########
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+const data = require('./json/index')
+
+const jsonServer = require('json-server')
+
+const server = jsonServer.create()
+const router = jsonServer.router(data)
+const middlewares = jsonServer.defaults()
+
+server.use(middlewares)
+
+// Have all URLS prefixed with /$
+server.use(
+  jsonServer.rewriter({
+    '/$/*': '/$1',
+    '/stats/ds1': '/ds1'
+  })
+)

Review comment:
       This `json-server` uses the JSON Server library to serve... err, well, JSON data. I used it in another project with GraphQL, and removes the need to have to start Jena and create a dataset and populate it in order for the tests to run (Skosmos does that, for example).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org