import postcss from 'postcss';
import test    from 'ava';

import plugin from './';

function run(t, input, output, opts = { }) {
    return postcss([ plugin(opts) ]).process(input)
        .then( result => {
            t.deepEqual(result.css, output);
            t.deepEqual(result.warnings().length, 0);
        });
}

/* Write tests here

test('does something', t => {
    return run(t, 'a{ }', 'a{ }', { });
});

*/

@@ -320,103 +320,1129 @@
 %0A%7D%0A%0A
-/* Write tests here%0A%0Atest('does something', t =%3E %7B%0A    return run(t, 'a%7B %7D', 'a%7B %7D', %7B %7D);%0A%7D);%0A%0A*/%0A
+test('compiles breakpoints shortcuts to @media rules', t =%3E %7B%0A    return run(%0A        t,%0A        'a %7Bfont-size:%7B 0: 14px; 768: 16px; 1600: 19px; %7D%7D',%0A        'a %7Bfont-size: 14px;%7D%5Cn@media screen and (min-width: 768px) %7B%5Cn%5Cta %7B%5Cn%5Ct%5Ctfont-size: 16px;%5Cn%5Ct%7D%5Cn%7D;%5Cn@media screen and (min-width: 1600px) %7B%5Cn%5Cta %7B%5Cn%5Ct%5Ctfont-size: 19px;%5Cn%5Ct%7D%5Cn%7D'%0A    );%0A%7D);%0A%0Atest('does not compile commented breakpoints', t =%3E %7B%0A    return run(%0A        t,%0A        'a %7Bfont-size: %7B 0: 14px; /*768: 16px;*/ %7D%7D',%0A        'a %7Bfont-size: 14px;%7D'%0A    );%0A%7D);%0A%0Atest('does not change commented blocks output', t =%3E %7B%0A    return run(%0A        t,%0A        '/*a %7Bfont-size: %7B 0: 14px; 768: 16px; %7D%7D*/',%0A        '/*a %7Bfont-size: %7B 0: 14px; 768: 16px; %7D%7D*/'%0A    );%0A%7D);%0A%0Atest('compiles breakpoints shortcuts to @media rules with variables', t =%3E %7B%0A    return run(%0A        t,%0A        '$tablet: 768px; a %7Bfont-size:%7B 0: 14px; tablet: 16px; 1600: 19px; %7D%7D',%0A        '$tablet: 768px; a %7Bfont-size: 14px;%7D @media screen and (min-width: $tablet) %7B%5Cn%5Cta %7B%5Cn%5Ct%5Ctfont-size: 16px;%5Cn%5Ct%7D%5Cn%7D; @media screen and (min-width: 1600px) %7B%5Cn%5Cta %7B%5Cn%5Ct%5Ctfont-size: 19px;%5Cn%5Ct%7D%5Cn%7D'%0A    );%0A%7D);

add tests