계정 정보 다이얼로그 추가 및 전체 목록 페치 개선
This commit is contained in:
34
test/features/auth/domain/entities/auth_permission_test.dart
Normal file
34
test/features/auth/domain/entities/auth_permission_test.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:superport_v2/core/permissions/permission_manager.dart';
|
||||
import 'package:superport_v2/features/auth/domain/entities/auth_permission.dart';
|
||||
|
||||
void main() {
|
||||
group('AuthPermission.toPermissionMap', () {
|
||||
test('백엔드 표준 문자열을 프런트 권한으로 매핑한다', () {
|
||||
final permission = AuthPermission(
|
||||
resource: '/approvals',
|
||||
actions: ['read', 'update', 'approve'],
|
||||
);
|
||||
|
||||
final result = permission.toPermissionMap();
|
||||
|
||||
expect(result, contains('/approvals'));
|
||||
final actions = result['/approvals']!;
|
||||
expect(actions.contains(PermissionAction.view), isTrue);
|
||||
expect(actions.contains(PermissionAction.edit), isTrue);
|
||||
expect(actions.contains(PermissionAction.approve), isTrue);
|
||||
});
|
||||
|
||||
test('알 수 없는 문자열은 무시해 빈 권한으로 반환한다', () {
|
||||
final permission = AuthPermission(
|
||||
resource: '/dashboard',
|
||||
actions: ['unknown', 'legacy'],
|
||||
);
|
||||
|
||||
final result = permission.toPermissionMap();
|
||||
|
||||
expect(result, isEmpty);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -60,7 +60,7 @@ void main() {
|
||||
verify(
|
||||
() => repository.list(
|
||||
page: 1,
|
||||
pageSize: 200,
|
||||
pageSize: any<int>(named: 'pageSize'),
|
||||
query: null,
|
||||
parentId: null,
|
||||
isActive: null,
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
|
||||
import 'package:superport_v2/features/masters/product/presentation/widgets/vendor_autocomplete_field.dart';
|
||||
import 'package:superport_v2/features/masters/vendor/domain/entities/vendor.dart';
|
||||
|
||||
void main() {
|
||||
group('VendorAutocompleteField', () {
|
||||
testWidgets('선택한 항목이 입력창에 반영된다', (tester) async {
|
||||
final vendors = [
|
||||
Vendor(
|
||||
id: 1,
|
||||
vendorCode: 'V001',
|
||||
vendorName: '테스트 제조사',
|
||||
isActive: true,
|
||||
isDeleted: false,
|
||||
),
|
||||
];
|
||||
int? selectedId;
|
||||
|
||||
await tester.pumpWidget(
|
||||
ShadApp(
|
||||
home: Scaffold(
|
||||
body: Center(
|
||||
child: VendorAutocompleteField(
|
||||
initialOptions: vendors,
|
||||
onSelected: (id) => selectedId = id,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// 포커스 후 옵션 선택
|
||||
await tester.tap(find.byType(ShadInput));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// RawAutocomplete 옵션은 Overlay에 그려진다.
|
||||
await tester.tap(find.text('테스트 제조사 (V001)'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(selectedId, equals(1));
|
||||
|
||||
final editableText = tester.widget<EditableText>(find.byType(EditableText));
|
||||
expect(editableText.controller.text, '테스트 제조사 (V001)');
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user