결재 템플릿 CRUD 화면과 컨트롤러 정식화
This commit is contained in:
@@ -207,11 +207,27 @@ void main() {
|
||||
group('loadTemplates', () {
|
||||
test('템플릿 목록을 불러오고 캐시한다', () async {
|
||||
when(
|
||||
() => templateRepository.list(activeOnly: any(named: 'activeOnly')),
|
||||
() => templateRepository.list(
|
||||
page: any(named: 'page'),
|
||||
pageSize: any(named: 'pageSize'),
|
||||
query: any(named: 'query'),
|
||||
isActive: any(named: 'isActive'),
|
||||
),
|
||||
).thenAnswer(
|
||||
(_) async => [
|
||||
ApprovalTemplate(id: 1, code: 'TEMP', name: '기본 템플릿', isActive: true),
|
||||
],
|
||||
(_) async => PaginatedResult<ApprovalTemplate>(
|
||||
items: [
|
||||
ApprovalTemplate(
|
||||
id: 1,
|
||||
code: 'TEMP',
|
||||
name: '기본 템플릿',
|
||||
isActive: true,
|
||||
steps: const [],
|
||||
),
|
||||
],
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
total: 1,
|
||||
),
|
||||
);
|
||||
|
||||
await controller.loadTemplates(force: true);
|
||||
@@ -224,13 +240,23 @@ void main() {
|
||||
await controller.loadTemplates();
|
||||
|
||||
verifyNever(
|
||||
() => templateRepository.list(activeOnly: any(named: 'activeOnly')),
|
||||
() => templateRepository.list(
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
query: null,
|
||||
isActive: true,
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test('에러 발생 시 errorMessage 설정', () async {
|
||||
when(
|
||||
() => templateRepository.list(activeOnly: any(named: 'activeOnly')),
|
||||
() => templateRepository.list(
|
||||
page: any(named: 'page'),
|
||||
pageSize: any(named: 'pageSize'),
|
||||
query: any(named: 'query'),
|
||||
isActive: any(named: 'isActive'),
|
||||
),
|
||||
).thenThrow(Exception('template fail'));
|
||||
|
||||
await controller.loadTemplates(force: true);
|
||||
@@ -375,6 +401,22 @@ void main() {
|
||||
],
|
||||
);
|
||||
|
||||
when(
|
||||
() => templateRepository.list(
|
||||
page: any(named: 'page'),
|
||||
pageSize: any(named: 'pageSize'),
|
||||
query: any(named: 'query'),
|
||||
isActive: any(named: 'isActive'),
|
||||
),
|
||||
).thenAnswer(
|
||||
(_) async => PaginatedResult<ApprovalTemplate>(
|
||||
items: [template],
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
total: 1,
|
||||
),
|
||||
);
|
||||
|
||||
when(
|
||||
() => templateRepository.fetchDetail(
|
||||
any(),
|
||||
@@ -382,10 +424,6 @@ void main() {
|
||||
),
|
||||
).thenAnswer((_) async => template);
|
||||
|
||||
when(
|
||||
() => templateRepository.list(activeOnly: any(named: 'activeOnly')),
|
||||
).thenAnswer((_) async => [template]);
|
||||
|
||||
when(
|
||||
() => repository.list(
|
||||
page: any(named: 'page'),
|
||||
|
||||
Reference in New Issue
Block a user