Fix up more test cases
This commit is contained in:
@@ -199,8 +199,10 @@ void main() {
|
||||
list.disableAll();
|
||||
list.setEnabled('prepatcher', true);
|
||||
final order = list.loadRequired();
|
||||
|
||||
final expected = ['harmony', 'prepatcher'];
|
||||
expect(order.errors, isEmpty);
|
||||
expect(order.loadOrder.indexOf('harmony'), isNot(-1));
|
||||
expect(order.loadOrder, equals(expected));
|
||||
});
|
||||
|
||||
test('Only required mods should be enabled', () {
|
||||
@@ -217,9 +219,10 @@ void main() {
|
||||
list.disableAll();
|
||||
list.setEnabled('prepatcher', true);
|
||||
final order = list.loadRequired();
|
||||
|
||||
final expected = ['harmony', 'prepatcher'];
|
||||
expect(order.errors, isEmpty);
|
||||
expect(order.loadOrder.indexOf('harmony'), isNot(-1));
|
||||
expect(order.loadOrder.indexOf('dummy'), -1);
|
||||
expect(order.loadOrder, equals(expected));
|
||||
});
|
||||
|
||||
test('Incompatible mods should return errors', () {
|
||||
@@ -241,9 +244,13 @@ void main() {
|
||||
list.setEnabled('incompatible', true);
|
||||
list.setEnabled('prepatcher', true);
|
||||
final result = list.loadRequired();
|
||||
|
||||
// We say the mods are incompatible but load them anyway, who are we to decide what isn't loaded?
|
||||
final expected = ['harmony', 'prepatcher', 'incompatible'];
|
||||
expect(result.errors, isNotEmpty);
|
||||
expect(result.errors.any((e) => e.contains('incompatible')), isTrue);
|
||||
expect(result.errors.any((e) => e.contains('harmony')), isTrue);
|
||||
expect(result.loadOrder, equals(expected));
|
||||
});
|
||||
test('Dependencies of dependencies should be loaded', () {
|
||||
final list = ModList();
|
||||
@@ -263,10 +270,10 @@ void main() {
|
||||
list.disableAll();
|
||||
list.setEnabled('modA', true);
|
||||
final order = list.loadRequired();
|
||||
|
||||
final expected = ['modC', 'modB', 'modA'];
|
||||
expect(order.errors, isEmpty);
|
||||
expect(order.loadOrder.indexOf('modA'), isNot(-1));
|
||||
expect(order.loadOrder.indexOf('modB'), isNot(-1));
|
||||
expect(order.loadOrder.indexOf('modC'), isNot(-1));
|
||||
expect(order.loadOrder, equals(expected));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -293,10 +300,15 @@ void main() {
|
||||
list.disableAll();
|
||||
list.setEnabled('modA', true);
|
||||
final result = list.loadRequired();
|
||||
|
||||
// We try to not disable mods...... But cyclic dependencies are just hell
|
||||
// Can not handle it
|
||||
final expected = [];
|
||||
expect(result.errors, isNotEmpty);
|
||||
expect(result.errors.any((e) => e.contains('modA')), isTrue);
|
||||
expect(result.errors.any((e) => e.contains('modB')), isTrue);
|
||||
expect(result.errors.any((e) => e.contains('modC')), isTrue);
|
||||
expect(result.loadOrder, equals(expected));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -317,13 +329,9 @@ void main() {
|
||||
list.enableAll();
|
||||
final order = list.generateLoadOrder();
|
||||
|
||||
final aIndex = order.loadOrder.indexOf('modA');
|
||||
final bIndex = order.loadOrder.indexOf('modB');
|
||||
final cIndex = order.loadOrder.indexOf('modC');
|
||||
|
||||
final expected = ['modB', 'modA', 'modC'];
|
||||
expect(order.errors, isEmpty);
|
||||
expect(aIndex, greaterThan(bIndex));
|
||||
expect(aIndex, lessThan(cIndex));
|
||||
expect(order.loadOrder, equals(expected));
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user