|
|
@@ -12,6 +12,8 @@ describe('modelNameToModelKey', function () {
|
|
|
'UserProfileDetails',
|
|
|
'user-profile-details',
|
|
|
'user_profile_details',
|
|
|
+ 'User-Profile-Details',
|
|
|
+ 'User_Profile_Details',
|
|
|
'USER-PROFILE-DETAILS',
|
|
|
'USER_PROFILE_DETAILS',
|
|
|
'USERPROFILEDETAILS',
|
|
|
@@ -34,6 +36,29 @@ describe('modelNameToModelKey', function () {
|
|
|
expect(modelNameToModelKey(modelName)).to.be.eq(expected);
|
|
|
});
|
|
|
|
|
|
+ it('should remove the "model" word from a model name', function () {
|
|
|
+ const modelNames = [
|
|
|
+ 'userProfileDetailsModel',
|
|
|
+ 'UserProfileDetailsModel',
|
|
|
+ 'user-profile-details-model',
|
|
|
+ 'user_profile_details_model',
|
|
|
+ 'User-Profile-Details-Model',
|
|
|
+ 'User_Profile_Details_Model',
|
|
|
+ 'USER-PROFILE-DETAILS-MODEL',
|
|
|
+ 'USER_PROFILE_DETAILS_MODEL',
|
|
|
+ ];
|
|
|
+ modelNames.forEach(v =>
|
|
|
+ expect(modelNameToModelKey(v)).to.be.eq('userprofiledetails'),
|
|
|
+ );
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should not remove the "model" suffix as a part of last word in a model name', function () {
|
|
|
+ const exceptions = ['SUPERMODEL', 'supermodel'];
|
|
|
+ exceptions.forEach(v =>
|
|
|
+ expect(modelNameToModelKey(v)).to.be.eq('supermodel'),
|
|
|
+ );
|
|
|
+ });
|
|
|
+
|
|
|
it('should throw an error for an empty string', function () {
|
|
|
const throwable = () => modelNameToModelKey('');
|
|
|
expect(throwable).to.throw(
|