Fix tests for SettingsModel

This commit is contained in:
Ashita Prasad
2024-12-21 17:51:33 +05:30
parent 774f6c1ef2
commit bd78c53609

View File

@ -17,6 +17,7 @@ void main() {
activeEnvironmentId: null, activeEnvironmentId: null,
historyRetentionPeriod: HistoryRetentionPeriod.oneWeek, historyRetentionPeriod: HistoryRetentionPeriod.oneWeek,
workspaceFolderPath: null, workspaceFolderPath: null,
isSSLDisabled: true,
); );
test('Testing toJson()', () { test('Testing toJson()', () {
@ -34,6 +35,7 @@ void main() {
"activeEnvironmentId": null, "activeEnvironmentId": null,
"historyRetentionPeriod": "oneWeek", "historyRetentionPeriod": "oneWeek",
"workspaceFolderPath": null, "workspaceFolderPath": null,
"isSSLDisabled": true,
}; };
expect(sm.toJson(), expectedResult); expect(sm.toJson(), expectedResult);
}); });
@ -53,6 +55,7 @@ void main() {
"activeEnvironmentId": null, "activeEnvironmentId": null,
"historyRetentionPeriod": "oneWeek", "historyRetentionPeriod": "oneWeek",
"workspaceFolderPath": null, "workspaceFolderPath": null,
"isSSLDisabled": true,
}; };
expect(SettingsModel.fromJson(input), sm); expect(SettingsModel.fromJson(input), sm);
}); });
@ -69,11 +72,13 @@ void main() {
promptBeforeClosing: true, promptBeforeClosing: true,
activeEnvironmentId: null, activeEnvironmentId: null,
historyRetentionPeriod: HistoryRetentionPeriod.oneWeek, historyRetentionPeriod: HistoryRetentionPeriod.oneWeek,
isSSLDisabled: false,
); );
expect( expect(
sm.copyWith( sm.copyWith(
isDark: true, isDark: true,
saveResponses: false, saveResponses: false,
isSSLDisabled: false,
), ),
expectedResult); expectedResult);
}); });
@ -92,7 +97,8 @@ void main() {
"promptBeforeClosing": true, "promptBeforeClosing": true,
"activeEnvironmentId": null, "activeEnvironmentId": null,
"historyRetentionPeriod": "oneWeek", "historyRetentionPeriod": "oneWeek",
"workspaceFolderPath": null "workspaceFolderPath": null,
"isSSLDisabled": true
}'''; }''';
expect(sm.toString(), expectedResult); expect(sm.toString(), expectedResult);
}); });