var identifier = require('../../lib/assert/identifier');

var should = require('chai').should();

describe('assert.identifier', function () {
    describe('hasSystem', function () {
        it('should throw exception if value undefined', function () {
            should.Throw(function () {
                identifier.hasSystem();
            });
        });

        it('should return a function', function () {
            var result = identifier.hasSystem('http://foo.com/bar');

            should.exist(result);
            result.should.be.a('Function');
        });

        it('should return false when system does not match value', function () {
            var candidate = {
                system: 'http://test.com/nomatch'
            };

            var fn = identifier.hasSystem('http://foo.com/bar');
            var result = fn(candidate);

            should.exist(result);
            result.should.equal(false);
        });

        it('should return true when system matches value', function () {
            var candidate = {
                system: 'http://foo.com/bar'
            };

            var fn = identifier.hasSystem('http://foo.com/bar');
            var result = fn(candidate);

            should.exist(result);
            result.should.equal(true);
        });
    });
});