Skip to content

Commit

Permalink
Add test case for constant export
Browse files Browse the repository at this point in the history
  • Loading branch information
tngan committed Dec 21, 2015
1 parent 1666219 commit 2f2faea
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
* @desc mocha test for Utility and SamlLib module
*/
// Package
var Utility = require('../lib/Utility');
var entry = require('../index');
var Utility = entry.Utility;
var should = require('should');
var fs = require('fs');
var SamlLib = require('../lib/SamlLib');
var SamlLib = entry.SamlLib;
var xpath = require('xpath');
var dom = require('xmldom').DOMParser;
var binding = require('../lib/urn').namespace.binding;
var binding = entry.Constants.namespace.binding;
var select = require('xml-crypto').xpath;
var algorithms = require('../lib/urn').algorithms;
var algorithms = entry.Constants.algorithms;
var signatureAlgorithms = algorithms.signature;

// Define of metadata
Expand All @@ -22,15 +23,15 @@ var _spPrivKey = _spKeyFolder + 'nocrypt.pem';
var _spPrivKeyPass = 'VHOSp5RUiBcrsjrcAuXFwU1NKCkGA8px';

// Define an identity provider
var idp = require('../lib/IdentityProvider')({
var idp = entry.IdentityProvider({
privateKeyFile: './test/key/idp/privkey.pem',
privateKeyFilePass: 'q9ALNhGT5EhfcRmp8Pg7e9zTQeP2x1bW',
isAssertionEncrypted: true,
encPrivateKeyFile: './test/key/idp/encryptKey.pem',
encPrivateKeyFilePass: 'g7hGcRmp8PxT5QeP2q9Ehf1bWe9zTALN'
},'./test/metadata/IDPMetadata.xml');

var sp = require('../lib/ServiceProvider')({
var sp = entry.ServiceProvider({
privateKeyFile: './test/key/sp/privkey.pem',
privateKeyFilePass: 'VHOSp5RUiBcrsjrcAuXFwU1NKCkGA8px',
isAssertionEncrypted: true, // for logout purpose
Expand All @@ -39,8 +40,8 @@ var sp = require('../lib/ServiceProvider')({
},'./test/metadata/SPMetadata.xml');

// Define metadata
var IdPMetadata = require('../lib/IdPMetadata')('./test/metadata/IDPMetadata.xml');
var SPMetadata = require('../lib/SPMetadata')('./test/metadata/SPMetadata.xml');
var IdPMetadata = entry.IdPMetadata('./test/metadata/IDPMetadata.xml');
var SPMetadata = entry.SPMetadata('./test/metadata/SPMetadata.xml');
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var sampleSignedResponse = fs.readFileSync('./test/metadata/SignSAMLResponse.xml').toString();
var wrongResponse = fs.readFileSync('./test/metadata/wrongResponse.xml').toString();
Expand Down Expand Up @@ -444,3 +445,11 @@ describe('2. SamlLib.js', function() {
});
});
});

describe('3 Constant.js', function() {
var entry = require('../index');
var constants = entry.Constants;
it('constants should be exported', function(done) {
if(typeof constants === 'object') done();
});
});

0 comments on commit 2f2faea

Please sign in to comment.