diff options
author | Justin Wernick <justin@worthe-it.co.za> | 2023-06-11 22:22:47 +0200 |
---|---|---|
committer | Justin Wernick <justin@worthe-it.co.za> | 2023-06-11 22:22:47 +0200 |
commit | be8d25968bfa511aa856759f6fbe9dfa5c8248f6 (patch) | |
tree | 650f99c6ce70bb8038883b6d7cff853ec0c48577 /test/amd.js | |
parent | cb35325c16760721e55783c4624ee63daa973f7c (diff) |
Added a test to ensure that importing with requirejs actually works
Re #10
Diffstat (limited to 'test/amd.js')
-rw-r--r-- | test/amd.js | 22 |
1 files changed, 22 insertions, 0 deletions
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); + }); +}); |