feat: add alot
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:kooltab2/models/product.dart';
|
||||
import 'package:kooltap/models/product.dart';
|
||||
|
||||
void main() {
|
||||
group('Product', () {
|
||||
@@ -44,47 +44,6 @@ void main() {
|
||||
});
|
||||
});
|
||||
|
||||
group('formattedPrice', () {
|
||||
test('formats price with euro symbol and 2 decimals', () {
|
||||
const product = Product(
|
||||
id: '1',
|
||||
name: 'Test',
|
||||
category: 'Drinks',
|
||||
stockQuantity: 10,
|
||||
lowStockThreshold: 5,
|
||||
priceInCents: 1234,
|
||||
);
|
||||
|
||||
expect(product.formattedPrice, '€12.34');
|
||||
});
|
||||
|
||||
test('formats zero price correctly', () {
|
||||
const product = Product(
|
||||
id: '1',
|
||||
name: 'Test',
|
||||
category: 'Drinks',
|
||||
stockQuantity: 10,
|
||||
lowStockThreshold: 5,
|
||||
priceInCents: 0,
|
||||
);
|
||||
|
||||
expect(product.formattedPrice, '€0.00');
|
||||
});
|
||||
|
||||
test('formats whole euros correctly', () {
|
||||
const product = Product(
|
||||
id: '1',
|
||||
name: 'Test',
|
||||
category: 'Drinks',
|
||||
stockQuantity: 10,
|
||||
lowStockThreshold: 5,
|
||||
priceInCents: 500,
|
||||
);
|
||||
|
||||
expect(product.formattedPrice, '€5.00');
|
||||
});
|
||||
});
|
||||
|
||||
group('copyWith', () {
|
||||
test('creates copy with updated fields', () {
|
||||
const original = Product(
|
||||
|
||||
Reference in New Issue
Block a user