import test from 'ava';
import b64 from '../';
import values from './fixtures/values';

test('b64.encode encodes string to Base64', async t => {
	const result = await b64.encode(values.string);
	t.is(result, values.base64);
});

test('b64.encode encodes buffer to Base64', async t => {
	const result = await b64.encode(values.buffer);
	t.is(result, values.base64);
});

test('b64.encode encodes correctly in chunks', async t => {
	const result = await b64.encode(values.buffer, { chunkSize: 3 });
	t.is(result, values.base64);
});

test('b64.encode rounds chunks up to multiples of 3', async t => {
	const result = await b64.encode(values.buffer, { chunkSize: 1 });
	t.is(result, values.base64);
});

@@ -673,28 +673,161 @@
 result, values.base64);%0A%7D);%0A
+%0Atest('b64.encode rejects Promise if chunkSize is 0', async t =%3E %7B%0A%09await t.throws(b64.encode(values.buffer, %7B chunkSize: 0 %7D));%0A%7D);%0A

Test b64.encode rejects Promise if chunkSize is 0