'use strict';

var Database = require('dbjs');

module.exports = function (t, a) {
	var db         = new Database()
	  , MasterType = db.Object.extend('MasterType')

	  , masterObject;

	// ------------------ Setup ------------------

	var DynamicCurrency = t(MasterType, 'DynamicCurrency', [
		require('dbjs-ext/number/currency/us-dollar')(db)
	]);

	MasterType.prototype.defineProperties({
		currencyField: {
			type: DynamicCurrency,
			nested: true
		}
	});

	masterObject = new MasterType();

	// ------------------ Tests ------------------

	a.h1('Dynamic fields');
	a(masterObject.hasPropertyDefined('dynamicCurrencyType'), true);
	a(masterObject.currencyField.hasPropertyDefined('value'), true);
	a(masterObject.currencyField.toString(), '0');
	masterObject.currencyField.value = 42;
	a(masterObject.currencyField.toString(), '42');
	masterObject.dynamicCurrencyType = 'usDollar';
	a(masterObject.currencyField.toString(), '$42');
};

@@ -744,9 +744,8 @@
 ), '
-0
 ');%0A

Update test