/
index.html
56 lines (47 loc) · 3.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>QUnit Example</title>
<script type="text/javascript" src="../src/csw4js.js"></script>
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
<script type="text/javascript" src="../node_modules/qunitjs/qunit/qunit.js"></script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script type="text/javascript">
var csw = new Csw4js.Csw('../examples/pycsw_cite.xml');
test('Smoke tests', function() {
strictEqual(csw.url, '../examples/pycsw_cite.xml', 'Valid URL');
strictEqual(csw.version, '2.0.2', 'Valid version');
strictEqual(csw.getOperationByName('GetCapabilities').dcp.http.get, 'http://demo.pycsw.org/cite/csw', 'Valid GetCapabilities URL');
strictEqual(typeof(csw), 'object', 'Valid JavaScript type');
});
test('GetCapabilities tests', function() {
strictEqual(csw.identification.title, 'pycsw Geospatial Catalogue OGC CITE demo and Reference Implementation', 'Valid title');
strictEqual(csw.identification.type, 'CSW', 'Valid service type');
strictEqual(csw.identification.version, '2.0.2', 'Valid service version');
strictEqual(csw.identification.keywords.length, 5, 'Valid number of keywords');
strictEqual(csw.identification.keywords[0], 'ogc', 'Valid keyword');
strictEqual(csw.identification.keywords[4], 'reference implementation', 'Valid keyword');
strictEqual(csw.provider.name, 'Organization Name', 'Valid provider name');
strictEqual(csw.provider.url, 'http://demo.pycsw.org/', 'Valid provide URL');
strictEqual(csw.operationsmetadata.operations.length, 8, 'Valid number of operations');
strictEqual(csw.operationsmetadata.parameters.length, 2, 'Valid number of parameters');
strictEqual(csw.operationsmetadata.constraints .length, 2, 'Valid number of constraints');
var getrecords = csw.getOperationByName('GetRecords');
strictEqual(getrecords.name, 'GetRecords', 'Valid operation name');
strictEqual(getrecords.parameters.length, 7, 'Valid number of parameters');
strictEqual(getrecords.dcp.http.get, 'http://demo.pycsw.org/cite/csw', 'Valid operation URL');
strictEqual(getrecords.dcp.http.post, 'http://demo.pycsw.org/cite/csw', 'Valid operation URL');
var false_value = csw.getOperationByName('invalid');
strictEqual(false_value, false, 'Invalid operation');
strictEqual(csw.filtercapabilities.spatials.geometries.length, 4, 'Valid number of geometries');
strictEqual(csw.filtercapabilities.spatials.operators.length, 11, 'Valid number of operators');
strictEqual(csw.filtercapabilities.scalars.comparisons.length, 9, 'Valid number of comparisons');
strictEqual(csw.filtercapabilities.scalars.functions.length, 6, 'Valid number of functions');
});
</script>
</body>
</html>