Skip to content

Commit

Permalink
Remove references to info.immutable
Browse files Browse the repository at this point in the history
This field no longer exists. The test checking this field
was also removed.
  • Loading branch information
EduardGomezEscandell committed Nov 7, 2023
1 parent 26d378f commit c3a3aa1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,18 @@ sealed class SubscriptionStatusModel {
SubscriptionInfo info,
AgentApiClient client,
) {
if (!info.immutable) {
switch (info.whichSubscriptionType()) {
case SubscriptionType.organization:
return OrgSubscriptionStatusModel();
case SubscriptionType.user:
return UserSubscriptionStatusModel(client);
case SubscriptionType.microsoftStore:
return StoreSubscriptionStatusModel(info.productId);
case SubscriptionType.none:
return SubscribeNowModel(client);
case SubscriptionType.notSet:
throw UnimplementedError('Unknown subscription type');
}
switch (info.whichSubscriptionType()) {
case SubscriptionType.organization:
return OrgSubscriptionStatusModel();
case SubscriptionType.user:
return UserSubscriptionStatusModel(client);
case SubscriptionType.microsoftStore:
return StoreSubscriptionStatusModel(info.productId);
case SubscriptionType.none:
return SubscribeNowModel(client);
case SubscriptionType.notSet:
throw UnimplementedError('Unknown subscription type');
}
return OrgSubscriptionStatusModel();
}
SubscriptionStatusModel._();
}
Expand Down
3 changes: 0 additions & 3 deletions gui/packages/ubuntupro/test/core/agent_api_client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ void main() {
test('no subscription info', () async {
final info = await client.subscriptionInfo();
expect(info.productId, isEmpty);
expect(info.immutable, isFalse);
expect(info.whichSubscriptionType(), SubscriptionType.none);
});
test('pro attach user subscription', () async {
await client.applyProToken('C123');
final info = await client.subscriptionInfo();

expect(info.productId, isEmpty);
expect(info.immutable, isFalse);
expect(info.whichSubscriptionType(), SubscriptionType.user);
});

Expand All @@ -38,7 +36,6 @@ void main() {
final info = await client.subscriptionInfo();

expect(info.productId, isEmpty);
expect(info.immutable, isFalse);
expect(info.whichSubscriptionType(), SubscriptionType.none);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,8 @@ void main() {
final info = SubscriptionInfo();
info.productId = 'my prod ID';

test('immutable is org', () async {
info.immutable = true;
final model = SubscriptionStatusModel(info, client);
expect(model.runtimeType, OrgSubscriptionStatusModel);
});

test('none subscribes now', () async {
info.ensureNone();
info.immutable = false;
final model = SubscriptionStatusModel(info, client);
expect(model.runtimeType, SubscribeNowModel);
});
Expand All @@ -42,23 +35,20 @@ void main() {
});
test('store', () async {
info.ensureMicrosoftStore();
info.immutable = false;

final model = SubscriptionStatusModel(info, client);
expect(model.runtimeType, StoreSubscriptionStatusModel);
});

test('user', () async {
info.ensureUser();
info.immutable = false;

final model = SubscriptionStatusModel(info, client);
expect(model.runtimeType, UserSubscriptionStatusModel);
});

test('organization', () async {
info.ensureOrganization();
info.immutable = false;

final model = SubscriptionStatusModel(info, client);
expect(model.runtimeType, OrgSubscriptionStatusModel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ void main() {
final info = SubscriptionInfo();
testWidgets('user', (tester) async {
info.ensureUser();
info.immutable = false;
final app = buildApp(info, client);

await tester.pumpWidget(app);
Expand All @@ -27,7 +26,6 @@ void main() {

testWidgets('store', (tester) async {
info.ensureMicrosoftStore();
info.immutable = false;
final app = buildApp(info, client);

await tester.pumpWidget(app);
Expand All @@ -40,7 +38,6 @@ void main() {

testWidgets('organization', (tester) async {
info.ensureOrganization();
info.immutable = false;
final app = buildApp(info, client);

await tester.pumpWidget(app);
Expand All @@ -55,7 +52,6 @@ void main() {
final mockClient = FakeAgentApiClient();
final info = ValueNotifier(SubscriptionInfo());
info.value.ensureUser();
info.value.immutable = false;
registerServiceInstance<AgentApiClient>(mockClient);
final app = ChangeNotifierProvider.value(
value: info,
Expand Down

0 comments on commit c3a3aa1

Please sign in to comment.