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.

56 lines
2.1 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.mkdirSync('fixtures/a');
  12. fs.symlinkSync('a', 'fixtures/b', 'junction');
  13. });
  14. after(() => {
  15. rimraf.sync('fixtures');
  16. });
  17. describe('.stat', () => {
  18. it('should work without options or settings', (done) => {
  19. _1.stat('fixtures/b', (error, stats) => {
  20. assert.strictEqual(error, null);
  21. assert.ok(stats);
  22. done();
  23. });
  24. });
  25. it('should work with options', (done) => {
  26. _1.stat('fixtures/b', { markSymbolicLink: true }, (error, stats) => {
  27. assert.strictEqual(error, null);
  28. assert.strictEqual(stats.isSymbolicLink(), true);
  29. done();
  30. });
  31. });
  32. it('should work with settings', (done) => {
  33. const settings = new _1.Settings({ markSymbolicLink: true });
  34. _1.stat('fixtures/b', settings, (error, stats) => {
  35. assert.strictEqual(error, null);
  36. assert.strictEqual(stats.isSymbolicLink(), true);
  37. done();
  38. });
  39. });
  40. });
  41. describe('.statSync', () => {
  42. it('should work without options or settings', () => {
  43. const actual = _1.statSync('fixtures/b');
  44. assert.ok(actual);
  45. });
  46. it('should work with options', () => {
  47. const actual = _1.statSync('fixtures/b', { markSymbolicLink: true });
  48. assert.strictEqual(actual.isSymbolicLink(), true);
  49. });
  50. it('should work with settings', () => {
  51. const settings = new _1.Settings({ markSymbolicLink: true });
  52. const actual = _1.statSync('fixtures/b', settings);
  53. assert.strictEqual(actual.isSymbolicLink(), true);
  54. });
  55. });
  56. });