Skip to content

Commit

Permalink
Fix test description, rename a valuable
Browse files Browse the repository at this point in the history
  • Loading branch information
mqkotoo committed Oct 4, 2023
1 parent faf0c56 commit 8e9c979
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions test/service/weather_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void main() {
});

group('failure case', () {
test('invalidParameter error', () {
test('invalidParameter error is thrown', () {
when(mockClient.fetchWeather(any))
.thenThrow(YumemiWeatherError.invalidParameter);

Expand All @@ -79,7 +79,7 @@ void main() {
);
});

test('unknown error', () {
test('unknown error is thrown', () {
when(mockClient.fetchWeather(any)).thenThrow(YumemiWeatherError.unknown);

final result =
Expand Down
12 changes: 6 additions & 6 deletions test/state/weather_state_notifier_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const jsonData = '''
}
''';

const invalidJsonDataForFromJsonException = '''
const invalidJsonDataForCheckedFromJsonException = '''
{
"weather_condition": "thunder",
"max_temperature": 25.0,
Expand Down Expand Up @@ -76,7 +76,7 @@ void main() {
});

group('failure case: getWeather()', () {
test('unknown error case', () {
test('an unknown error is thrown', () {
when(mockClient.fetchWeather(any)).thenThrow(YumemiWeatherError.unknown);

// 表示されるエラーメッセージを格納
Expand All @@ -97,7 +97,7 @@ void main() {
expect(errorMessage, '予期せぬエラーが発生しました。');
});

test('invalidParameter error case', () {
test('invalidParameter error is thrown', () {
when(mockClient.fetchWeather(any))
.thenThrow(YumemiWeatherError.invalidParameter);

Expand All @@ -119,9 +119,9 @@ void main() {
expect(errorMessage, 'パラメータが有効ではありません。');
});

test('fromJson error case', () {
test('CheckedFromJsonException error is thrown', () {
when(mockClient.fetchWeather(any))
.thenReturn(invalidJsonDataForFromJsonException);
.thenReturn(invalidJsonDataForCheckedFromJsonException);

// 表示されるエラーメッセージを格納
String? errorMessage;
Expand All @@ -141,7 +141,7 @@ void main() {
expect(errorMessage, '不適切なデータを取得しました。');
});

test('jsonDecode() error case', () {
test('received data is not in JSON format', () {
when(mockClient.fetchWeather(any))
.thenReturn(invalidJsonDataForFormatException);

Expand Down

0 comments on commit 8e9c979

Please sign in to comment.