web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.6 KiB

  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const assert = require("assert");
  4. const fs = require("fs");
  5. const rimraf = require("rimraf");
  6. const _1 = require(".");
  7. describe('Package', () => {
  8. before(() => {
  9. rimraf.sync('fixtures');
  10. fs.mkdirSync('fixtures');
  11. fs.writeFileSync('fixtures/file.txt', '');
  12. });
  13. after(() => {
  14. rimraf.sync('fixtures');
  15. });
  16. describe('.scandir', () => {
  17. it('should work without options or settings', (done) => {
  18. _1.scandir('fixtures', (error, entries) => {
  19. assert.strictEqual(error, null);
  20. assert.ok(entries[0].name);
  21. assert.ok(entries[0].path);
  22. assert.ok(entries[0].dirent);
  23. done();
  24. });
  25. });
  26. it('should work with options', (done) => {
  27. _1.scandir('fixtures', { stats: true }, (error, entries) => {
  28. assert.strictEqual(error, null);
  29. assert.ok(entries[0].name);
  30. assert.ok(entries[0].path);
  31. assert.ok(entries[0].dirent);
  32. assert.ok(entries[0].stats);
  33. done();
  34. });
  35. });
  36. it('should work with settings', (done) => {
  37. const settings = new _1.Settings({ stats: true });
  38. _1.scandir('fixtures', settings, (error, entries) => {
  39. assert.strictEqual(error, null);
  40. assert.ok(entries[0].name);
  41. assert.ok(entries[0].path);
  42. assert.ok(entries[0].dirent);
  43. assert.ok(entries[0].stats);
  44. done();
  45. });
  46. });
  47. });
  48. describe('.scandirSync', () => {
  49. it('should work without options or settings', () => {
  50. const actual = _1.scandirSync('fixtures');
  51. assert.ok(actual[0].name);
  52. assert.ok(actual[0].path);
  53. assert.ok(actual[0].dirent);
  54. });
  55. it('should work with options', () => {
  56. const actual = _1.scandirSync('fixtures', { stats: true });
  57. assert.ok(actual[0].name);
  58. assert.ok(actual[0].path);
  59. assert.ok(actual[0].dirent);
  60. assert.ok(actual[0].stats);
  61. });
  62. it('should work with settings', () => {
  63. const settings = new _1.Settings({ stats: true });
  64. const actual = _1.scandirSync('fixtures', settings);
  65. assert.ok(actual[0].name);
  66. assert.ok(actual[0].path);
  67. assert.ok(actual[0].dirent);
  68. assert.ok(actual[0].stats);
  69. });
  70. });
  71. });