summaryrefslogtreecommitdiff
path: root/test/amd.js
blob: 03bd71610b54ce611a394ac47024571a9a85f4b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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);
  });
});