@include test-module('oBrandIs') {
	@include test('Returns true when the given brand is the brand set by the user') {
		// Set fake brand.
		$original-brand: $o-brand;
		$o-brand: 'internal' !global;
		@include assert-true(oBrandIs('internal'));
		// Restore brand after test.
		$o-brand: $original-brand !global;
	}
	@include test('Returns false when the given brand is not the current brand set by the user') {
		// Set fake brand.
		$original-brand: $o-brand;
		$o-brand: 'core' !global;
		@include assert-false(oBrandIs('whitelabel'));
		// Restore brand after test.
		$o-brand: $original-brand !global;
	}
	@include test('Returns true for the default brand when a brand is not set') {
		// Set fake brand.
		$original-brand: $o-brand;
		$o-brand: null !global;
		@include assert-true(oBrandIs('core'));
		// Restore brand after test.
		$o-brand: $original-brand !global;
	}
	@include test('Throws error if a brand that is not master, core, internal, or whitelabel is set') {
		// Set fake brand.
		$original-brand: $o-brand;
		$o-brand: 'non-existent-brand' !global;
		$expected-error: 'o-brand error: The brand "non-existent-brand" is not supported by o-brand. Please use one of core, internal, whitelabel.';
		$result: oBrandIs('core');
		@include assert-equal($result, $expected-error);
		// Restore brand after test.
		$o-brand: $original-brand !global;
	}
}

@include test-module('oBrandGetCurrentBrand') {
	@include test('Defaults to master if no brand is defined.') {
		// Set fake brand.
		$original-brand: $o-brand;
		$o-brand: null !global;
		$o-brand: oBrandGetCurrentBrand();
		@include assert-equal($o-brand, master);
		// Restore brand after test.
		$o-brand: $original-brand !global;
	}
	@include test('Returns "master" (deprecated) if the "core" brand is set.') {
		// Set fake brand.
		$original-brand: $o-brand;
		$o-brand: core !global;
		$o-brand: oBrandGetCurrentBrand();
		@include assert-equal($o-brand, master);
		// Restore brand after test.
		$o-brand: $original-brand !global;
	}
}

@include test-module('oBrandGet') {
	@include test('Gets a default variable value for a defined brand') {
		$property: oBrandGet($component: 'o-example', $variables: 'example-background');
		@include assert-equal($property, white);
	}

	@include test('Concatenates multiple variables for use in one property value') {
		$property: oBrandGet($component: 'o-example', $variables: (example-border-width example-border-style example-border-color));
		@include assert-equal($property, 1px solid grey);
	}

	@include test('Gets a variable value from a variant') {
		$property: oBrandGet($component: 'o-example', $variables: 'example-background', $from: 'inverse');
		@include assert-equal($property, grey);
	}

	@include test('Gets a variable value from a custom variant') {
		$property: oBrandGet($component: 'o-example', $variables: 'example-background', $from: ('example-background': hotpink));
		@include assert-equal($property, hotpink);
	}

	@include test('Gets null from a variant with no variables defined') {
		$property: oBrandGet($component: 'o-example', $variables: 'example-background', $from: 'compact');
		@include assert-equal($property, null);
	}
}

@include test-module('oBrandSupportsVariant') {
	@include test('Returns false if a brand does not support the variant') {
		$support: oBrandSupportsVariant($component: 'o-example', $variant: 'unsupported');
		@include assert-equal($support, false);
	}

	@include test('Returns true if a brand does support the variant') {
		$support: oBrandSupportsVariant($component: 'o-example', $variant: 'b2b');
		@include assert-equal($support, true);
	}
}

@include test-module('_oBrandGetCurrentValidBrand') {
	@include test('Throws error if a brand that is not core, internal or whitelabel is defined.') {
		// Set fake brand.
		$original-brand: $o-brand;
		$o-brand: 'non-existent-brand' !global;
		$error: 'o-brand error: The brand "non-existent-brand" is not supported by o-brand. Please use one of core, internal, whitelabel.';
		$non-brand: _oBrandGetCurrentValidBrand();
		@include assert-equal($non-brand, $error);
		// Restore brand after test.
		$o-brand: $original-brand !global;
	}

	@include test('Defaults to core if no brand is defined.') {
		// Set fake brand.
		$original-brand: $o-brand;
		$o-brand: null !global;
		$o-brand: _oBrandGetCurrentValidBrand();
		@include assert-equal($o-brand, core);
		// Restore brand after test.
		$o-brand: $original-brand !global;
	}
}
