-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from olexale/bugfix/comments_fix
Fix #73
- Loading branch information
Showing
3 changed files
with
89 additions
and
1 deletion.
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
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,87 @@ | ||
import 'package:bdd_widget_test/src/feature_file.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
void main() { | ||
test('Comments above features copy-paste into the target file', () { | ||
const featureFile = ''' | ||
// This is a comment | ||
Feature: Testing feature | ||
Scenario: Testing scenario | ||
Given the app is running | ||
'''; | ||
|
||
const expectedFeatureDart = ''' | ||
// GENERATED CODE - DO NOT MODIFY BY HAND | ||
// ignore_for_file: unused_import, directives_ordering | ||
// This is a comment | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import './step/the_app_is_running.dart'; | ||
void main() { | ||
group(\'\'\'Testing feature\'\'\', () { | ||
testWidgets(\'\'\'Testing scenario\'\'\', (tester) async { | ||
await theAppIsRunning(tester); | ||
}); | ||
}); | ||
} | ||
'''; | ||
|
||
final feature = FeatureFile( | ||
featureDir: 'test.feature', | ||
package: 'test', | ||
input: featureFile, | ||
); | ||
expect(feature.dartContent, expectedFeatureDart); | ||
}); | ||
|
||
test('Comments after first feature are ignored', () { | ||
const featureFile = ''' | ||
Feature: Testing feature | ||
This is a comment | ||
Scenario: Testing scenario | ||
Given the app is running | ||
This is another comment | ||
Feature: Testing feature 2 | ||
This is a comment | ||
Scenario: Testing scenario | ||
Given the app is running | ||
This is a comment too | ||
'''; | ||
|
||
const expectedFeatureDart = ''' | ||
// GENERATED CODE - DO NOT MODIFY BY HAND | ||
// ignore_for_file: unused_import, directives_ordering | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import './step/the_app_is_running.dart'; | ||
void main() { | ||
group(\'\'\'Testing feature\'\'\', () { | ||
testWidgets(\'\'\'Testing scenario\'\'\', (tester) async { | ||
await theAppIsRunning(tester); | ||
}); | ||
}); | ||
group(\'\'\'Testing feature 2\'\'\', () { | ||
testWidgets(\'\'\'Testing scenario\'\'\', (tester) async { | ||
await theAppIsRunning(tester); | ||
}); | ||
}); | ||
} | ||
'''; | ||
|
||
final feature = FeatureFile( | ||
featureDir: 'test.feature', | ||
package: 'test', | ||
input: featureFile, | ||
); | ||
expect(feature.dartContent, expectedFeatureDart); | ||
}); | ||
} |
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