buddy

node MVC discord bot
Log | Files | Refs | README

precedence.js (605B)


      1 var path = require('path');
      2 var test = require('tape');
      3 var resolve = require('../');
      4 
      5 test('precedence', function (t) {
      6     t.plan(3);
      7     var dir = path.join(__dirname, 'precedence/aaa');
      8     
      9     resolve('./', { basedir : dir }, function (err, res, pkg) {
     10         t.ifError(err);
     11         t.equal(res, path.join(dir, 'index.js'));
     12         t.equal(pkg.name, 'resolve');
     13     });
     14 });
     15 
     16 test('./ should not load ${dir}.js', function (t) {
     17     t.plan(1);
     18     var dir = path.join(__dirname, 'precedence/bbb');
     19     
     20     resolve('./', { basedir : dir }, function (err, res, pkg) {
     21         t.ok(err);
     22     });
     23 });