/*global describe, it*/
var expect = require('./unexpected-with-plugins'),
    query = require('../lib').query;

describe('query', function () {
    it('it should throw on error conditions', function (done) {
        expect(function andUndefined() { query.and(); }, 'to throw');
        expect(function andSingle() { query.and({}); }, 'to throw');

        expect(function orUndefined() { query.or(); }, 'to throw');
        expect(function orSingle() { query.or({}); }, 'to throw');

        expect(function notDouble() { query.not({}, {}); }, 'to throw');

        done();
    });

    it ('it should implement boolean AND correctly', function (done) {
        var andQuery = query.and({
                type: 'Html'
            },
            {
                isInline: false
            });

        expect(andQuery, 'to be a function');

        expect([
            {
                type: 'Html',
                isInline: false
            },
            {
                type: 'Html',
                isInline: false,
                foo: 'bar'
            },
            {
                type: 'Html',
                isInline: false,
                inline: function () { return 'foo'; }
            },
            {
                type: 'Html',
                isInline: false,
                matcher: /^http:/
            },
            {
                type: 'Html',
                isInline: false,
                amount: 10
            }
        ], 'to be an array whose items satisfy', function (item) {
            expect(andQuery(item), 'to be true');
        });

        expect([
            {
                type: 'JavaScript',
                isInline: false
            },
            {
                type: 'Css',
                isInline: false,
                foo: 'bar'
            },
            {
                type: 'HtmlTemplate',
                isInline: false,
                inline: function () { return 'foo'; }
            },
            {
                type: 'Html',
                isInline: true,
                matcher: /^http:/
            },
            {
                type: 'Xml',
                isInline: true,
                amount: 10
            }
        ], 'to be an array whose items satisfy', function (item) {
            expect(andQuery(item), 'to be false');
        });

        done();
    });
});

@@ -2334,32 +2334,1552 @@
 );%0A        %7D);%0A%0A
+        done();%0A    %7D);%0A%0A    it ('it should implement boolean OR correctly', function (done) %7B%0A        var orQuery = query.or(%7B%0A                type: 'Html'%0A            %7D,%0A            %7B%0A                isInline: false%0A            %7D);%0A%0A        expect(orQuery, 'to be a function');%0A%0A        expect(%5B%0A            %7B%0A                type: 'Html',%0A                isInline: true%0A            %7D,%0A            %7B%0A                type: 'Html',%0A                isInline: false%0A            %7D,%0A            %7B%0A                type: 'Html'%0A            %7D,%0A            %7B%0A                isInline: false%0A            %7D,%0A            %7B%0A                type: 'Html',%0A                isInline: true,%0A                amount: 10%0A            %7D%0A        %5D, 'to be an array whose items satisfy', function (item) %7B%0A            expect(orQuery(item), 'to be true');%0A        %7D);%0A%0A        expect(%5B%0A            %7B%7D,%0A            %7B%0A                type: 'JavaScript',%0A                isInline: true%0A            %7D,%0A            %7B%0A                type: 'Css',%0A                foo: 'bar'%0A            %7D,%0A            %7B%0A                type: 'HtmlTemplate',%0A                inline: function () %7B return 'foo'; %7D%0A            %7D,%0A            %7B%0A                isInline: true,%0A                matcher: /%5Ehttp:/%0A            %7D,%0A            %7B%0A                type: 'Xml',%0A                isInline: true,%0A                amount: 10%0A            %7D%0A        %5D, 'to be an array whose items satisfy', function (item) %7B%0A            expect(orQuery(item), 'to be false');%0A        %7D);%0A%0A
         done();%0A

Add tests for query or conditions