index.js 769 B

123456789101112131415161718192021222324252627
  1. 'use strict';
  2. var test = require('tape');
  3. var inspect = require('object-inspect');
  4. var forEach = require('for-each');
  5. var v = require('es-value-fixtures');
  6. var isSharedArrayBuffer = require('..');
  7. test('isSharedArrayBuffer', function (t) {
  8. t.equal(typeof isSharedArrayBuffer, 'function', 'is a function');
  9. var nonSABs = v.primitives.concat(v.objects);
  10. forEach(nonSABs, function (nonSAB) {
  11. t.equal(isSharedArrayBuffer(nonSAB), false, inspect(nonSAB) + ' is not a SharedArrayBuffer');
  12. });
  13. t.test('actual SharedArrayBuffer instances', { skip: typeof SharedArrayBuffer === 'undefined' }, function (st) {
  14. var sab = new SharedArrayBuffer();
  15. st.equal(isSharedArrayBuffer(sab), true, inspect(sab) + ' is a SharedArrayBuffer');
  16. st.end();
  17. });
  18. t.end();
  19. });