Compare commits
5 Commits
eea520a62f
...
6995d05f48
| Author | SHA1 | Date | |
|---|---|---|---|
| 6995d05f48 | |||
| 88bd5bdeef | |||
| 75f8e30707 | |||
| 5c5f0966df | |||
| 14687ae2ba |
@@ -11,6 +11,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Install system dependencies
|
||||||
|
run: apt-get update && apt-get install -y jq unzip xz-utils curl git
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -20,11 +23,14 @@ jobs:
|
|||||||
flutter-version: '3.x'
|
flutter-version: '3.x'
|
||||||
channel: stable
|
channel: stable
|
||||||
|
|
||||||
|
- name: Fix git safe directory
|
||||||
|
run: git config --global --add safe.directory '*'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: flutter pub get
|
run: flutter pub get
|
||||||
|
|
||||||
- name: Analyze
|
- name: Analyze
|
||||||
run: flutter analyze
|
run: flutter analyze --no-fatal-infos
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: flutter test
|
run: flutter test
|
||||||
@@ -35,6 +41,9 @@ jobs:
|
|||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Install system dependencies
|
||||||
|
run: apt-get update && apt-get install -y jq unzip xz-utils curl git
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -50,6 +59,9 @@ jobs:
|
|||||||
flutter-version: '3.x'
|
flutter-version: '3.x'
|
||||||
channel: stable
|
channel: stable
|
||||||
|
|
||||||
|
- name: Fix git safe directory
|
||||||
|
run: git config --global --add safe.directory '*'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: flutter pub get
|
run: flutter pub get
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import '../../../shared/services/api_client.dart';
|
import '../../../shared/services/api_client.dart';
|
||||||
import '../../../shared/providers/auth_provider.dart';
|
|
||||||
|
|
||||||
final clientsProvider = FutureProvider.autoDispose
|
final clientsProvider = FutureProvider.autoDispose
|
||||||
.family<List<Map<String, dynamic>>, String?>((ref, search) async {
|
.family<List<Map<String, dynamic>>, String?>((ref, search) async {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import '../../../shared/services/api_client.dart';
|
import '../../../shared/services/api_client.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:network_app/features/auth/presentation/login_screen.dart';
|
import 'package:network_app/features/auth/presentation/login_screen.dart';
|
||||||
import 'package:network_app/shared/providers/auth_provider.dart';
|
|
||||||
import 'package:network_app/shared/services/api_client.dart';
|
import 'package:network_app/shared/services/api_client.dart';
|
||||||
import 'package:mocktail/mocktail.dart';
|
import 'package:mocktail/mocktail.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:network_app/features/clients/presentation/clients_screen.dart';
|
import 'package:network_app/features/clients/presentation/clients_screen.dart';
|
||||||
import 'package:network_app/shared/providers/auth_provider.dart';
|
|
||||||
import 'package:network_app/shared/services/api_client.dart';
|
import 'package:network_app/shared/services/api_client.dart';
|
||||||
import 'package:mocktail/mocktail.dart';
|
import 'package:mocktail/mocktail.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
@@ -53,7 +52,7 @@ void main() {
|
|||||||
'company': null,
|
'company': null,
|
||||||
};
|
};
|
||||||
|
|
||||||
final company = client['company'] as String?;
|
final company = client['company'];
|
||||||
expect(company, isNull);
|
expect(company, isNull);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -64,7 +63,7 @@ void main() {
|
|||||||
'company': '',
|
'company': '',
|
||||||
};
|
};
|
||||||
|
|
||||||
final company = client['company'] as String?;
|
final company = client['company'];
|
||||||
final hasCompany = company != null && company.isNotEmpty;
|
final hasCompany = company != null && company.isNotEmpty;
|
||||||
expect(hasCompany, isFalse);
|
expect(hasCompany, isFalse);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'dart:async';
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:network_app/shared/providers/auth_provider.dart';
|
import 'package:network_app/shared/providers/auth_provider.dart';
|
||||||
@@ -63,6 +62,7 @@ void main() {
|
|||||||
test('initial state checks session', () async {
|
test('initial state checks session', () async {
|
||||||
when(() => mockApiClient.getSession()).thenAnswer((_) async => null);
|
when(() => mockApiClient.getSession()).thenAnswer((_) async => null);
|
||||||
|
|
||||||
|
// ignore: unused_local_variable
|
||||||
final notifier = container.read(authStateProvider.notifier);
|
final notifier = container.read(authStateProvider.notifier);
|
||||||
|
|
||||||
// Wait for async initialization
|
// Wait for async initialization
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:dio/dio.dart';
|
|
||||||
import 'package:mocktail/mocktail.dart';
|
|
||||||
|
|
||||||
// Unit tests for API client logic (without actual HTTP calls)
|
// Unit tests for API client logic (without actual HTTP calls)
|
||||||
void main() {
|
void main() {
|
||||||
@@ -100,7 +98,7 @@ void main() {
|
|||||||
test('query parameters include values when set', () {
|
test('query parameters include values when set', () {
|
||||||
final params = <String, dynamic>{};
|
final params = <String, dynamic>{};
|
||||||
|
|
||||||
const search = 'John';
|
final String? search = 'John'; // runtime to avoid unnecessary_null_comparison
|
||||||
const String? tag = null;
|
const String? tag = null;
|
||||||
|
|
||||||
if (search != null) params['search'] = search;
|
if (search != null) params['search'] = search;
|
||||||
|
|||||||
Reference in New Issue
Block a user