test.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. var Assert = require('assert');
  2. var Asserts = require('asserts');
  3. Asserts(function () {
  4. var lib = require('./lib');
  5. return {
  6. "requireindex should": {
  7. "properly include files parallel to index.js and maintain structure": function () {
  8. Asserts.all.equal([
  9. [lib.bam.m, [], "ok"],
  10. [lib.bar.f, [], "yea"],
  11. [lib.bar.fing, [], 'definitely'],
  12. [lib.Foo.l, [], 'yes'],
  13. [lib.Foo.ls, [], 'yep'],
  14. [lib.bam.n, [], 'ack'],
  15. [lib.bar.fed.again, [], 'again'],
  16. [lib.bar.fed.somemore, [], 'somemore']
  17. ]);
  18. },
  19. "ignore _ prefixed files": function () {
  20. Assert.equal(('_private' in lib), false);
  21. },
  22. "not include files not mentioned when second array argument is used": function () {
  23. Assert.equal(('ignored' in lib.bar.fed), false);
  24. },
  25. "ignore non javascript files": function () {
  26. Assert.equal(('not_javascript' in lib), false);
  27. },
  28. "sort files by lowercase alpha of the filename": function () {
  29. Assert.equal(Object.keys(lib)[0], 'bam');
  30. },
  31. "ignore dot files": function () {
  32. Assert.equal(('.also_private' in lib), false);
  33. },
  34. }
  35. };
  36. });