Skip to content

Commit

Permalink
Verify files at different levels in test
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkoren committed Jan 13, 2020
1 parent 774022c commit bcd4142
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions test/dartdoc_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -410,15 +410,20 @@ void main() {
test('rel canonical prefix does not include base href', () async {
final String prefix = 'foo.bar/baz';
Dartdoc dartdoc = await buildDartdoc(
['--rel-canonical-prefix', prefix], testPackageMinimumDir, tempDir);
['--rel-canonical-prefix', prefix], testPackageDir, tempDir);
await dartdoc.generateDocsBase();

File file = File(path.join(tempDir.path, 'small', 'small-library.html'));
expect(file.existsSync(), isTrue);
// Verify files at different levels have correct <link> content.
File level1 = File(path.join(tempDir.path, 'ex', 'Apple-class.html'));
expect(level1.existsSync(), isTrue);
expect(
file.readAsStringSync(),
level1.readAsStringSync(),
contains(
'<link rel="canonical" href="$prefix/small/small-library.html">'));
'<link rel="canonical" href="$prefix/ex/Apple-class.html">'));
File level2 = File(path.join(tempDir.path, 'ex', 'Apple', 'm.html'));
expect(level2.existsSync(), isTrue);
expect(level2.readAsStringSync(),
contains('<link rel="canonical" href="$prefix/ex/Apple/m.html">'));
});
}, timeout: Timeout.factor(8));
}

0 comments on commit bcd4142

Please sign in to comment.