This repository has been archived by the owner on Jan 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: questions_repository | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
push: | ||
paths: | ||
- "packages/questions_repository/**" | ||
- ".github/workflows/questions_repository.yaml" | ||
|
||
pull_request: | ||
paths: | ||
- "packages/questions_repository/**" | ||
- ".github/workflows/questions_repository.yaml" | ||
|
||
jobs: | ||
build: | ||
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1 | ||
with: | ||
working_directory: packages/questions_repository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 27 additions & 2 deletions
29
packages/questions_repository/test/src/questions_repository_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,36 @@ | ||
// ignore_for_file: prefer_const_constructors | ||
import 'package:api_client/api_client.dart'; | ||
import 'package:mocktail/mocktail.dart'; | ||
import 'package:questions_repository/questions_repository.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
class _MockQuestionsResource extends Mock implements QuestionsResource {} | ||
|
||
class _FakeVertexResponse extends Fake implements VertexResponse {} | ||
|
||
void main() { | ||
group('QuestionsRepository', () { | ||
test('can be instantiated', () { | ||
expect(QuestionsRepository(), isNotNull); | ||
late QuestionsResource questionsResource; | ||
late QuestionsRepository questionsRepository; | ||
|
||
setUp(() { | ||
questionsResource = _MockQuestionsResource(); | ||
questionsRepository = QuestionsRepository(questionsResource); | ||
}); | ||
|
||
setUpAll(() { | ||
registerFallbackValue(_FakeVertexResponse()); | ||
}); | ||
|
||
group('getVertexResponse', () { | ||
test('returns VertexResponse', () { | ||
when(() => questionsResource.getVertexResponse(any())) | ||
.thenAnswer((_) async => _FakeVertexResponse()); | ||
expectLater( | ||
questionsRepository.getVertexResponse(''), | ||
completion(isA<VertexResponse>()), | ||
); | ||
}); | ||
}); | ||
}); | ||
} |