/*global describe, it */
'use strict';

var assert = require('assert');
var archiveType = require('../');
var fs = require('fs');
var path = require('path');

describe('extname()', function () {
    function check(file) {
        return archiveType(fs.readFileSync(file));
    }

    it('should detect archive type from Buffer', function (cb) {
        assert.strictEqual(check(path.join(__dirname, 'fixtures/test.tar')), 'tar');
        assert.strictEqual(check(path.join(__dirname, 'fixtures/test.zip')), 'zip');
        cb();
    });
});

'use strict';

var archiveType = require('../');
var fs = require('fs');
var path = require('path');
var test = require('ava');

test('detect archive type from Buffer', function (t) {
    t.plan(2);

    function c(file) {
        return archiveType(fs.readFileSync(file));
    }

    t.assert(c(path.join(__dirname, 'fixtures/test.tar')) === 'tar');
    t.assert(c(path.join(__dirname, 'fixtures/test.zip')) === 'zip');
});

Use ava for testing