Skip to content

Commit

Permalink
add Qunit web test
Browse files Browse the repository at this point in the history
  • Loading branch information
nxi committed Aug 23, 2024
1 parent 2989352 commit 11066e5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bragg/nbi/au.gov.ansto.bragg.nbi.webserver/WebContent/QUnit.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test Suite</title>
<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.21.0.css">
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script type="text/javascript">
const _DEBUG_ENABLED = true;
</script>
<script src="js/jquery/jquery-1.10.2.min.js"></script>
<script src="js/sedbConfig.js"></script>
<script src="https://code.jquery.com/qunit/qunit-2.21.0.js"></script>
<script src="js/QUnitCases.js"></script>
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function add(a, b) {
return a + b;
}

QUnit.module('add', function() {
QUnit.test('two numbers', function(assert) {
const a = 2;
assert.equal(add(1, a), 3);
});
});

QUnit.module('SEDB', function() {
QUnit.test('DBModel', function(assert) {
assert.equal(add(1, 2), 3);
const dbModel = new DBModel();
dbModel.load();
assert.ok(dbModel != null);
});
});

0 comments on commit 11066e5

Please sign in to comment.