Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
var tape = require( 'tape' );
var hasProp = require( '@stdlib/assert/has-property' );
var isFunction = require( '@stdlib/assert/is-function' );
var format = require( '@stdlib/string/format' );
var namedtypedtuple = require( './../lib' );


Expand Down Expand Up @@ -87,7 +88,7 @@ tape( 'the method serializes a tuple as a locale-specific string (default locale
Point = namedtypedtuple( [ 'price', 'quantity' ] );
p = new Point( [ 123456.789, 9876 ] );

expected = 'tuple(price=' + (123456.789).toLocaleString() + ', quantity=' + (9876).toLocaleString() + ')';
expected = format( 'tuple(price=%s, quantity=%s)', (123456.789).toLocaleString(), (9876).toLocaleString() );
actual = p.toLocaleString();

t.strictEqual( actual, expected, 'returns expected value' );
Expand All @@ -103,7 +104,7 @@ tape( 'the method serializes a tuple as a locale-specific string (specified loca
Point = namedtypedtuple( [ 'price', 'quantity' ] );
p = new Point( [ 123456.789, 9876 ] );

expected = 'tuple(price=123.456,789, quantity=9.876)';
expected = format( 'tuple(price=%s, quantity=%s)', (123456.789).toLocaleString( 'de-DE' ), (9876).toLocaleString( 'de-DE' ) );
actual = p.toLocaleString( 'de-DE' );

t.strictEqual( actual, expected, 'returns expected value' );
Expand All @@ -124,7 +125,7 @@ tape( 'the method serializes a tuple as a locale-specific string (locale and opt
'currency': 'USD'
};

expected = 'tuple(price=' + (1234.56).toLocaleString( 'en-US', opts ) + ', quantity=' + (50).toLocaleString( 'en-US', opts ) + ')';
expected = format( 'tuple(price=%s, quantity=%s)', (1234.56).toLocaleString( 'en-US', opts ), (50).toLocaleString( 'en-US', opts ) );
actual = p.toLocaleString( 'en-US', opts );

t.strictEqual( actual, expected, 'returns expected value' );
Expand Down