const test = require('tape');
const mockery = require('mockery');
const mocks = require('./mocks');

mockery.registerAllowable('./index.js');
mockery.registerAllowable('../lib/command/donate.js');
mockery.registerMock('../../blitzbot.json', {
	paypal: {
		me: 'https://paypal.me/CodeMan99'
	}
});
mockery.enable();

const donate = require('../lib/command/donate.js');

mockery.disable();
mockery.deregisterAll();

const callDonate = donate.fn.bind(mocks.commands);

test('donate', t => {
	t.deepEqual(donate.fn.options, {
		argCount: 0,
		argSplit: ' ',
		description: 'Get a link to generously donate via paypal.',
		passRecord: false,
		signatures: ['@BOTNAME donate']
	}, 'verify options');

	t.equal(donate.name, 'donate', 'verify Commands method name');

	t.test('command', st => {
		callDonate(mocks.createMessage(null, 'NiceDude [CL]')).then(result => {
			const link = result.sentMsg.split(' ').slice(-1)[0];

			st.equal(link, 'https://paypal.me/CodeMan99', 'link is at the end of reply');
			st.end();
		}, error => { st.fail(error); st.end(); });
	});

	t.end();
});

@@ -55,24 +55,72 @@
 'mockery');%0A
+const %7BautoEndTest%7D = require('./.utility.js');%0A
 const mocks 
@@ -824,18 +824,57 @@
 d', 
-st =%3E %7B%0A%09%09
+autoEndTest(async st =%3E %7B%0A%09%09const result = await 
 call
@@ -927,27 +927,10 @@
 %5D'))
-.then(result =%3E %7B%0A%09
+;%0A
 %09%09co
@@ -981,17 +981,16 @@
 1)%5B0%5D;%0A%0A
-%09
 %09%09st.equ
@@ -1066,68 +1066,10 @@
 );%0A%09
-%09%09st.end();%0A%09%09%7D, error =%3E %7B st.fail(error); st.end(); %7D);%0A%09
 %7D
+)
 );%0A%0A

Use async patterns to test donate command.