/* global AJS:false */
AJS.test.require('com.atlassian.bitbucket.server.bitbucket-it-javascript:firstnonnull-test', function () {

	module('soyfuncs-firstnonnull', function () {

	});

	function trim(str) {
		return str.replace(/^\s+/, '');
	}

	test('it works in the simple case', function () {
		equal(trim(bitbucket.internal.test.soyfuncs.firstNonNullParamless()), 'always');
	});

	test('it works without an optional param', function () {
		equal(trim(bitbucket.internal.test.soyfuncs.firstNonNullSimple()), 'definitely');
	});

	test('it can handle false params', function () {
		equal(trim(bitbucket.internal.test.soyfuncs.firstNonNullSimple({
			maybe: false
		})), "false");
	});

	test('it works with an optional param', function () {
		equal(trim(bitbucket.internal.test.soyfuncs.firstNonNullSimple({
			maybe: 'optional'
		})), 'optional');
	});
});