mirror of
https://github.com/foss42/apidash.git
synced 2025-11-30 17:59:18 +08:00
Fix SettingsModel equality for defaultAIModel map
Replaces direct comparison of defaultAIModel with mapEquals to ensure deep equality. Updates related tests to include defaultAIModel in test cases for serialization, deserialization, copyWith, and toString.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import 'package:apidash_core/apidash_core.dart';
|
import 'package:apidash_core/apidash_core.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:apidash/consts.dart';
|
import 'package:apidash/consts.dart';
|
||||||
|
|
||||||
@@ -213,7 +214,7 @@ class SettingsModel {
|
|||||||
other.workspaceFolderPath == workspaceFolderPath &&
|
other.workspaceFolderPath == workspaceFolderPath &&
|
||||||
other.isSSLDisabled == isSSLDisabled &&
|
other.isSSLDisabled == isSSLDisabled &&
|
||||||
other.isDashBotEnabled == isDashBotEnabled &&
|
other.isDashBotEnabled == isDashBotEnabled &&
|
||||||
other.defaultAIModel == defaultAIModel;
|
mapEquals(other.defaultAIModel, defaultAIModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ void main() {
|
|||||||
workspaceFolderPath: null,
|
workspaceFolderPath: null,
|
||||||
isSSLDisabled: true,
|
isSSLDisabled: true,
|
||||||
isDashBotEnabled: true,
|
isDashBotEnabled: true,
|
||||||
|
defaultAIModel: {"model": "llama"},
|
||||||
);
|
);
|
||||||
|
|
||||||
test('Testing toJson()', () {
|
test('Testing toJson()', () {
|
||||||
@@ -38,6 +39,7 @@ void main() {
|
|||||||
"workspaceFolderPath": null,
|
"workspaceFolderPath": null,
|
||||||
"isSSLDisabled": true,
|
"isSSLDisabled": true,
|
||||||
"isDashBotEnabled": true,
|
"isDashBotEnabled": true,
|
||||||
|
"defaultAIModel": {"model": "llama"}
|
||||||
};
|
};
|
||||||
expect(sm.toJson(), expectedResult);
|
expect(sm.toJson(), expectedResult);
|
||||||
});
|
});
|
||||||
@@ -59,6 +61,7 @@ void main() {
|
|||||||
"workspaceFolderPath": null,
|
"workspaceFolderPath": null,
|
||||||
"isSSLDisabled": true,
|
"isSSLDisabled": true,
|
||||||
"isDashBotEnabled": true,
|
"isDashBotEnabled": true,
|
||||||
|
"defaultAIModel": {"model": "llama"}
|
||||||
};
|
};
|
||||||
expect(SettingsModel.fromJson(input), sm);
|
expect(SettingsModel.fromJson(input), sm);
|
||||||
});
|
});
|
||||||
@@ -77,6 +80,7 @@ void main() {
|
|||||||
historyRetentionPeriod: HistoryRetentionPeriod.oneWeek,
|
historyRetentionPeriod: HistoryRetentionPeriod.oneWeek,
|
||||||
isSSLDisabled: false,
|
isSSLDisabled: false,
|
||||||
isDashBotEnabled: false,
|
isDashBotEnabled: false,
|
||||||
|
defaultAIModel: {"model": "llama"},
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
sm.copyWith(
|
sm.copyWith(
|
||||||
@@ -104,7 +108,10 @@ void main() {
|
|||||||
"historyRetentionPeriod": "oneWeek",
|
"historyRetentionPeriod": "oneWeek",
|
||||||
"workspaceFolderPath": null,
|
"workspaceFolderPath": null,
|
||||||
"isSSLDisabled": true,
|
"isSSLDisabled": true,
|
||||||
"isDashBotEnabled": true
|
"isDashBotEnabled": true,
|
||||||
|
"defaultAIModel": {
|
||||||
|
"model": "llama"
|
||||||
|
}
|
||||||
}''';
|
}''';
|
||||||
expect(sm.toString(), expectedResult);
|
expect(sm.toString(), expectedResult);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user