a zip code crypto-currency system good for red ONLY

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*eslint new-cap: ["error", {"capIsNewExceptions": ["Color"]}]*/
  2. var assert = require('assert'),
  3. path = require('path'),
  4. etx = require('../lib/extensions'),
  5. binding = process.env.NODESASS_COV
  6. ? require('../lib-cov/binding')
  7. : require('../lib/binding');
  8. describe('binding', function() {
  9. describe('missing error', function() {
  10. it('should be useful', function() {
  11. process.env.SASS_BINARY_NAME = 'unknown-x64-48';
  12. assert.throws(
  13. function() { binding(etx); },
  14. function(err) {
  15. var re = new RegExp('Missing binding.*?\\' + path.sep + 'vendor\\' + path.sep);
  16. if ((err instanceof Error)) {
  17. return re.test(err);
  18. }
  19. }
  20. );
  21. });
  22. it('should list currently installed bindings', function() {
  23. assert.throws(
  24. function() { binding(etx); },
  25. function(err) {
  26. var etx = require('../lib/extensions');
  27. delete process.env.SASS_BINARY_NAME;
  28. if ((err instanceof Error)) {
  29. return err.message.indexOf(
  30. etx.getHumanEnvironment(etx.getBinaryName())
  31. ) !== -1;
  32. }
  33. }
  34. );
  35. });
  36. });
  37. describe('on unsupported environment', function() {
  38. describe('with an unsupported architecture', function() {
  39. beforeEach(function() {
  40. Object.defineProperty(process, 'arch', {
  41. value: 'foo',
  42. });
  43. });
  44. afterEach(function() {
  45. Object.defineProperty(process, 'arch', {
  46. value: 'x64',
  47. });
  48. });
  49. it('should error', function() {
  50. assert.throws(
  51. function() { binding(etx); },
  52. 'Node Sass does not yet support your current environment'
  53. );
  54. });
  55. it('should inform the user the architecture is unsupported', function() {
  56. assert.throws(
  57. function() { binding(etx); },
  58. 'Unsupported architecture (foo)'
  59. );
  60. });
  61. });
  62. describe('with an unsupported platform', function() {
  63. beforeEach(function() {
  64. Object.defineProperty(process, 'platform', {
  65. value: 'bar',
  66. });
  67. });
  68. afterEach(function() {
  69. Object.defineProperty(process, 'platform', {
  70. value: 'darwin',
  71. });
  72. });
  73. it('should error', function() {
  74. assert.throws(
  75. function() { binding(etx); },
  76. 'Node Sass does not yet support your current environment'
  77. );
  78. });
  79. it('should inform the user the platform is unsupported', function() {
  80. assert.throws(
  81. function() { binding(etx); },
  82. 'Unsupported platform (bar)'
  83. );
  84. });
  85. });
  86. describe('with an unsupported runtime', function() {
  87. beforeEach(function() {
  88. Object.defineProperty(process.versions, 'modules', {
  89. value: 'baz',
  90. });
  91. });
  92. afterEach(function() {
  93. Object.defineProperty(process.versions, 'modules', {
  94. value: 51,
  95. });
  96. });
  97. it('should error', function() {
  98. assert.throws(
  99. function() { binding(etx); },
  100. 'Node Sass does not yet support your current environment'
  101. );
  102. });
  103. it('should inform the user the runtime is unsupported', function() {
  104. assert.throws(
  105. function() { binding(etx); },
  106. 'Unsupported runtime (baz)'
  107. );
  108. });
  109. });
  110. });
  111. });