blob: 4fcf23f99f54341c25d11fe4140d3eac91c9575a [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'dart:io';
import 'package:lib_setui_common/action.dart';
import 'package:lib_setui_common/conductor_builder.dart';
import 'package:mockito/mockito.dart';
import 'package:test/test.dart';
/// A well-formed syllabus with single use id.
const String _syllabus = '''
entry: start
action: begin
class MockFile extends Mock implements File {}
class MockBlueprint extends Mock implements Blueprint {}
class MockAction extends Mock implements Action {}
void main() {
// Make sure first action is launched.
test('test_start', () async {
final MockFile syllabusFile = new MockFile();
final MockBlueprint blueprint = new MockBlueprint();
final MockAction action = new MockAction();
final Completer<String> completer = new Completer<String>()
// Load predefined syllabus when
when(syllabusFile.readAsString()).thenAnswer((_) => completer.future);
when(blueprint.assemble(any, any)).thenReturn(action);
final ConductorBuilder builder = new ConductorBuilder(syllabusFile)
// Ensure blueprint is assembled
verify(blueprint.assemble(any, any));
// Ensure action is launched