forked from jhipster/generator-jhipster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbundle_test.html
70 lines (59 loc) · 1.6 KB
/
bundle_test.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!--
Simple Mocha html runner to test the bundled artifact works in browsers.
This is just a simple manual smoke test...
-->
<html>
<head>
<meta charset="utf-8">
<title>Mocha Tests</title>
<link href="https://unpkg.com/mocha@5.2.0/mocha.css" rel="stylesheet" />
</head>
<body>
<div id="mocha"></div>
<!-- runtime dependencies -->
<script src='../node_modules/lodash/lodash.min.js'></script>
<!-- our bundled JDL DSL apis -->
<script src='../dist/jdl-core.min.js'></script>
<!-- test Libraries -->
<script src="https://unpkg.com/chai@4.1.2/chai.js"></script>
<script src="https://unpkg.com/mocha@5.2.0/mocha.js"></script>
<script>
mocha.setup('bdd');
window.expect = chai.expect;
</script>
<script>
const parse = window.jdlCore.parse;
describe('JDL browser bundle', () => {
context('when wanting an AST', () => {
context('with a valid input', () => {
let ast;
before(() => {
ast = parse('@service(serviceClass) entity A {field String}');
});
it('returns an AST', () => {
expect(ast.entities).to.have.lengthOf(1);
expect(ast.entities[0]).to.deep.eql({
name: 'A',
tableName: 'A',
annotations: [{ option: 'service', method: 'serviceClass', type: 'BINARY' }],
body: [
{
name: 'field',
type: 'String',
validations: [],
javadoc: null
}
],
javadoc: null
});
});
});
})
})
</script>
<script>
mocha.checkLeaks();
mocha.run();
</script>
</body>
</html>