결재 API 계약 보완 및 테스트 정리
This commit is contained in:
@@ -98,8 +98,8 @@ void main() {
|
||||
|
||||
expect(captured.first, equals(path));
|
||||
final query = captured[1] as Map<String, dynamic>;
|
||||
expect(query['date_from'], '2024-01-01');
|
||||
expect(query['date_to'], '2024-01-31');
|
||||
expect(query['from'], '2024-01-01');
|
||||
expect(query['to'], '2024-01-31');
|
||||
expect(query['format'], 'xlsx');
|
||||
expect(query['transaction_status_id'], 3);
|
||||
expect(query['approval_status_id'], 7);
|
||||
@@ -143,10 +143,69 @@ void main() {
|
||||
|
||||
final result = await repository.exportApprovals(request);
|
||||
|
||||
final captured = verify(
|
||||
() => apiClient.get<Uint8List>(
|
||||
captureAny(),
|
||||
query: captureAny(named: 'query'),
|
||||
options: any(named: 'options'),
|
||||
cancelToken: any(named: 'cancelToken'),
|
||||
),
|
||||
).captured;
|
||||
|
||||
expect(captured.first, equals(path));
|
||||
final query = captured[1] as Map<String, dynamic>;
|
||||
expect(query['from'], DateTime(2024, 2, 1).toIso8601String());
|
||||
expect(query['to'], DateTime(2024, 2, 15).toIso8601String());
|
||||
expect(query['format'], 'pdf');
|
||||
expect(query.containsKey('transaction_status_id'), isFalse);
|
||||
expect(result.hasBytes, isTrue);
|
||||
expect(result.bytes, isNotNull);
|
||||
expect(result.filename, 'approval.pdf');
|
||||
expect(result.mimeType, 'application/pdf');
|
||||
expect(result.hasDownloadUrl, isFalse);
|
||||
});
|
||||
|
||||
test('exportApprovals는 transaction_status_id 파라미터를 전달한다', () async {
|
||||
const path = '/api/v1/reports/approvals/export';
|
||||
when(
|
||||
() => apiClient.get<Uint8List>(
|
||||
path,
|
||||
query: any(named: 'query'),
|
||||
options: any(named: 'options'),
|
||||
cancelToken: any(named: 'cancelToken'),
|
||||
),
|
||||
).thenAnswer(
|
||||
(_) async => binaryResponse(
|
||||
path,
|
||||
bytes: [4, 5, 6],
|
||||
filename: 'approval.xlsx',
|
||||
mimeType:
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
),
|
||||
);
|
||||
|
||||
final request = ReportExportRequest(
|
||||
from: DateTime(2024, 4, 1),
|
||||
to: DateTime(2024, 4, 30),
|
||||
format: ReportExportFormat.xlsx,
|
||||
transactionStatusId: 2,
|
||||
approvalStatusId: 4,
|
||||
);
|
||||
|
||||
await repository.exportApprovals(request);
|
||||
|
||||
final captured = verify(
|
||||
() => apiClient.get<Uint8List>(
|
||||
captureAny(),
|
||||
query: captureAny(named: 'query'),
|
||||
options: any(named: 'options'),
|
||||
cancelToken: any(named: 'cancelToken'),
|
||||
),
|
||||
).captured;
|
||||
|
||||
expect(captured.first, equals(path));
|
||||
final query = captured[1] as Map<String, dynamic>;
|
||||
expect(query['transaction_status_id'], 2);
|
||||
expect(query['approval_status_id'], 4);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user