summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2023-06-11 22:22:47 +0200
committerJustin Wernick <justin@worthe-it.co.za>2023-06-11 22:22:47 +0200
commitbe8d25968bfa511aa856759f6fbe9dfa5c8248f6 (patch)
tree650f99c6ce70bb8038883b6d7cff853ec0c48577 /test
parentcb35325c16760721e55783c4624ee63daa973f7c (diff)
Added a test to ensure that importing with requirejs actually works
Re #10
Diffstat (limited to 'test')
-rw-r--r--test/.eslintrc.json5
-rw-r--r--test/amd.js22
-rw-r--r--test/test.js3
3 files changed, 27 insertions, 3 deletions
diff --git a/test/.eslintrc.json b/test/.eslintrc.json
new file mode 100644
index 0000000..10d2238
--- /dev/null
+++ b/test/.eslintrc.json
@@ -0,0 +1,5 @@
+{
+ "env": {
+ "node": true
+ }
+}
diff --git a/test/amd.js b/test/amd.js
new file mode 100644
index 0000000..03bd716
--- /dev/null
+++ b/test/amd.js
@@ -0,0 +1,22 @@
+'use strict';
+
+var path = require('path');
+var mocha = require('mocha');
+var describe = mocha.describe;
+var it = mocha.it;
+var expect = require('chai').expect;
+const requirejs = require('requirejs');
+
+// node require isn't provided here, so it has to use the AMD import option to
+// import it.
+requirejs.config({
+ baseUrl: path.join(__dirname, "..")
+});
+
+describe('Asynchronous Module Definition', function () {
+ it('can import the module using RequireJS', function() {
+ var saIdParser = requirejs('south-african-id-parser.js');
+ var validIdNumber = '1012311412187';
+ expect(saIdParser.validate(validIdNumber)).to.equal(true);
+ });
+});
diff --git a/test/test.js b/test/test.js
index 7fdf6d7..c31f179 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1,7 +1,4 @@
'use strict';
-/*jshint
- node: true
-*/
var mocha = require('mocha');
var describe = mocha.describe;