From 6468af07cfde1911af0e5832886af1ce4ed197e2 Mon Sep 17 00:00:00 2001 From: Rogier Spieker Date: Mon, 19 Oct 2015 09:58:29 +0200 Subject: [PATCH] Added tests for the optional/impliciet version flag --- test/require.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/require.js b/test/require.js index 5b8a2e7..aa04565 100644 --- a/test/require.js +++ b/test/require.js @@ -124,4 +124,28 @@ lab.experiment('Wanted - Unknown', function() { }); }); + lab.experiment('Install version specific requirements', function() { + lab.test('Require an unknown module', {timeout: 15000}, function(done) { + var wanted = new Wanted(), + blame = wanted.require('blame'); + + // we expect the blame module to exist and be the (version agnostic) module we wanted + Code.expect('stack' in blame).to.equal(true); + Code.expect(typeof blame.stack).to.equal('function'); + + done(); + }); + + lab.test('Require the (implicit) latest version', {timeout: 15000}, function(done) { + var wanted = new Wanted(), + blame = wanted.require('blame', true); + + // we expect the blame module to exist and be the (version agnostic) module we wanted + Code.expect('stack' in blame).to.equal(true); + Code.expect(typeof blame.stack).to.equal('function'); + + done(); + }); + }); + });