Sha256: 51a9cbdf8838f7cb499d2d14a223b2257d7ca4c688d497f6449390980d33fa52

Contents?: true

Size: 993 Bytes

Versions: 2

Compression:

Stored size: 993 Bytes

Contents

'use strict';

var expect = require('expect.js');
var glob = require('glob');

var imageSize = require('..');

// Test all unsupported files
describe('Unsupported Images', function () {

  var unsupportedFiles = glob.sync('specs/images/unsupported/**/*.*');
  unsupportedFiles.forEach(function (file) {

    describe(file, function () {

      it('should throw, if no callback is passed', function () {
        var calculate = imageSize.bind(null, file);
        expect(calculate).to.throwException(function (e) {
          expect(e).to.be.a(TypeError);
          expect(e.message).to.be('unsupported file type');
        });
      });

      it('shouldn\'t throw, if a callback is passed', function (done) {
        var calculate = imageSize.bind(null, file, function (e) {
          expect(e).to.be.a(TypeError);
          expect(e.message).to.be('unsupported file type');
          done();
        });
        expect(calculate).to.not.throwException(TypeError);
      });
    });
  });
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
less-execjs-2.6.0.4 lib/less/js/image-size/specs/unsupported.spec.js
less-execjs-2.6.0.3 lib/less/js/image-size/specs/unsupported.spec.js