Skip to content

Commit 8b13464

Browse files
committed
test money decoding
1 parent e3343fb commit 8b13464

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/webserver/database/sql_to_json.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ mod tests {
187187
'{\"key\": \"value\"}'::JSON as json,
188188
'{\"key\": \"value\"}'::JSONB as jsonb,
189189
age('2024-03-14'::timestamp, '2024-01-01'::timestamp) as age_interval,
190-
justify_interval(interval '1 year 2 months 3 days') as justified_interval",
190+
justify_interval(interval '1 year 2 months 3 days') as justified_interval,
191+
1234.56::MONEY as money_val",
191192
)
192193
.fetch_one(&mut c)
193194
.await?;
@@ -211,7 +212,8 @@ mod tests {
211212
"json": {"key": "value"},
212213
"jsonb": {"key": "value"},
213214
"age_interval": "2 mons 13 days",
214-
"justified_interval": "1 year 2 mons 3 days"
215+
"justified_interval": "1 year 2 mons 3 days",
216+
"money_val": 1234.56
215217
}),
216218
);
217219
Ok(())
@@ -366,7 +368,9 @@ mod tests {
366368
CAST('2024-03-14 13:14:15' AS DATETIME2) as datetime2,
367369
CAST('2024-03-14 13:14:15 +02:00' AS DATETIMEOFFSET) as datetimeoffset,
368370
N'Unicode String' as nvarchar,
369-
'ASCII String' as varchar",
371+
'ASCII String' as varchar,
372+
CAST(1234.56 AS MONEY) as money_val,
373+
CAST(12.34 AS SMALLMONEY) as small_money_val",
370374
)
371375
.fetch_one(&mut c)
372376
.await?;
@@ -391,6 +395,8 @@ mod tests {
391395
"datetimeoffset": "2024-03-14T13:14:15+02:00",
392396
"nvarchar": "Unicode String",
393397
"varchar": "ASCII String",
398+
"money_val": 1234.56,
399+
"small_money_val": 12.34
394400
}),
395401
);
396402
Ok(())

0 commit comments

Comments
 (0)