test.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. const assume = require('assume');
  2. const tripleBeam = require('./');
  3. describe('triple-beam', function () {
  4. describe('LEVEL constant', function () {
  5. it('is exposed', function () {
  6. assume(tripleBeam.LEVEL);
  7. });
  8. it('is a Symbol', function () {
  9. assume(tripleBeam.LEVEL).is.a('symbol');
  10. });
  11. it('is not mutable', function () {
  12. //
  13. // Assert that the symbol does not change
  14. // even though the operation does not throw.
  15. //
  16. const OVERWRITE = Symbol('overwrite');
  17. const LEVEL = tripleBeam.LEVEL;
  18. assume(LEVEL).not.equals(OVERWRITE);
  19. tripleBeam.LEVEL = OVERWRITE;
  20. assume(tripleBeam.LEVEL).equals(LEVEL);
  21. });
  22. });
  23. describe('MESSAGE constant', function () {
  24. it('is exposed', function () {
  25. assume(tripleBeam.MESSAGE);
  26. });
  27. it('is a Symbol', function () {
  28. assume(tripleBeam.MESSAGE).is.a('symbol');
  29. });
  30. it('is not mutable', function () {
  31. //
  32. // Assert that the symbol does not change
  33. // even though the operation does not throw.
  34. //
  35. const OVERWRITE = Symbol('overwrite');
  36. const MESSAGE = tripleBeam.MESSAGE;
  37. assume(MESSAGE).not.equals(OVERWRITE);
  38. tripleBeam.MESSAGE = OVERWRITE;
  39. assume(tripleBeam.MESSAGE).equals(MESSAGE);
  40. });
  41. });
  42. describe('SPLAT constant', function () {
  43. it('is exposed', function () {
  44. assume(tripleBeam.SPLAT);
  45. });
  46. it('is a Symbol', function () {
  47. assume(tripleBeam.SPLAT).is.a('symbol');
  48. });
  49. it('is not mutable', function () {
  50. //
  51. // Assert that the symbol does not change
  52. // even though the operation does not throw.
  53. //
  54. const OVERWRITE = Symbol('overwrite');
  55. const SPLAT = tripleBeam.SPLAT;
  56. assume(SPLAT).not.equals(OVERWRITE);
  57. tripleBeam.SPLAT = OVERWRITE;
  58. assume(tripleBeam.SPLAT).equals(SPLAT);
  59. });
  60. });
  61. describe('configs constant', function () {
  62. it('is exposed', function () {
  63. assume(tripleBeam.configs);
  64. });
  65. it('is a Symbol', function () {
  66. assume(tripleBeam.configs).is.an('Object');
  67. });
  68. it('is not mutable', function () {
  69. //
  70. // Assert that the object does not change
  71. // even though the operation does not throw.
  72. //
  73. const overwrite = {
  74. overwrite: 'overwrite'
  75. };
  76. const configs = tripleBeam.configs;
  77. assume(configs).not.equals(overwrite);
  78. tripleBeam.configs = overwrite;
  79. assume(tripleBeam.configs).equals(configs);
  80. });
  81. });
  82. });