1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 22:09:06 +00:00

Fix sample index deployment action (#862)

* Update sample index dependencies

* Update to tuneup 0.3.8, update dependencies

* Upgrade to null safety, lock sass version

* fix analyzer warnings

* Fix unit tests

* Fix issues from upgrading to null safety
This commit is contained in:
John Ryan
2021-08-02 15:41:18 -07:00
committed by GitHub
parent 699cc3a8c5
commit 7de8fafcee
17 changed files with 153 additions and 102 deletions

View File

@@ -16,15 +16,18 @@ void main() {
var contents = await file.readAsString();
expect(contents, isNotEmpty);
var index = checkedYamlDecode(contents, (m) => Index.fromJson(m),
var index = checkedYamlDecode(contents, (m) => m != null ? Index.fromJson(m) : null,
sourceUrl: file.uri);
if (index == null) {
throw('unable to load YAML from $file');
}
expect(index.samples, isNotEmpty);
var sample = index.samples.first;
expect(sample, isNotNull);
expect(sample.name, 'Kittens');
expect(sample.screenshots, hasLength(2));
expect(sample.source, 'http://github.com/johnpryan/kittens');
expect(sample.source, 'https://github.com/johnpryan/kittens');
expect(sample.description, 'A sample kitten app');
expect(sample.difficulty, 'beginner');
expect(sample.widgets, hasLength(2));
@@ -36,7 +39,7 @@ void main() {
expect(sample.platforms, hasLength(3));
expect(sample.links, hasLength(2));
expect(sample.links[1].text, 'author');
expect(sample.links[1].href, 'http://jpryan.me');
expect(sample.links[1].href, 'https://jpryan.me');
expect(sample.type, 'sample');
expect(sample.date, DateTime.parse('2019-12-15T02:59:43.1Z'));
expect(sample.channel, 'stable');
@@ -49,8 +52,11 @@ void main() {
var contents = await file.readAsString();
expect(contents, isNotEmpty);
var index = checkedYamlDecode(contents, (m) => Index.fromJson(m),
var index = checkedYamlDecode(contents, (m) => m != null ? Index.fromJson(m) : null,
sourceUrl: file.uri);
if (index == null) {
throw('unable to load YAML from $file');
}
var sample = index.samples.first;
expect(
sample.searchAttributes.split(' '),