|
6 | 6 | createFilenameForPackage, |
7 | 7 | loadDataExtensionYaml, |
8 | 8 | } from "../../../src/model-editor/yaml"; |
9 | | -import { CallClassification } from "../../../src/model-editor/method"; |
| 9 | +import { CallClassification, Method } from "../../../src/model-editor/method"; |
10 | 10 | import { QueryLanguage } from "../../../src/common/query-language"; |
| 11 | +import { ModeledMethod } from "../../../src/model-editor/modeled-method"; |
11 | 12 |
|
12 | 13 | describe("createDataExtensionYaml", () => { |
13 | 14 | it("creates the correct YAML file", () => { |
@@ -980,6 +981,132 @@ describe("createDataExtensionYamlsForFrameworkMode", () => { |
980 | 981 | `, |
981 | 982 | }); |
982 | 983 | }); |
| 984 | + |
| 985 | + describe("with same package names but different capitalizations", () => { |
| 986 | + const methods: Method[] = [ |
| 987 | + { |
| 988 | + library: "HostTestAppDbContext", |
| 989 | + signature: |
| 990 | + "Volo.Abp.TestApp.MongoDb.HostTestAppDbContext#get_FifthDbContextDummyEntity()", |
| 991 | + packageName: "Volo.Abp.TestApp.MongoDb", |
| 992 | + typeName: "HostTestAppDbContext", |
| 993 | + methodName: "get_FifthDbContextDummyEntity", |
| 994 | + methodParameters: "()", |
| 995 | + supported: false, |
| 996 | + supportedType: "none", |
| 997 | + usages: [], |
| 998 | + }, |
| 999 | + { |
| 1000 | + library: "CityRepository", |
| 1001 | + signature: |
| 1002 | + "Volo.Abp.TestApp.MongoDB.CityRepository#FindByNameAsync(System.String)", |
| 1003 | + packageName: "Volo.Abp.TestApp.MongoDB", |
| 1004 | + typeName: "CityRepository", |
| 1005 | + methodName: "FindByNameAsync", |
| 1006 | + methodParameters: "(System.String)", |
| 1007 | + supported: false, |
| 1008 | + supportedType: "none", |
| 1009 | + usages: [], |
| 1010 | + }, |
| 1011 | + ]; |
| 1012 | + const newModeledMethods: Record<string, ModeledMethod[]> = { |
| 1013 | + "Volo.Abp.TestApp.MongoDb.HostTestAppDbContext#get_FifthDbContextDummyEntity()": |
| 1014 | + [ |
| 1015 | + { |
| 1016 | + type: "sink", |
| 1017 | + input: "Argument[0]", |
| 1018 | + kind: "sql", |
| 1019 | + provenance: "df-generated", |
| 1020 | + signature: |
| 1021 | + "Volo.Abp.TestApp.MongoDb.HostTestAppDbContext#get_FifthDbContextDummyEntity()", |
| 1022 | + packageName: "Volo.Abp.TestApp.MongoDb", |
| 1023 | + typeName: "HostTestAppDbContext", |
| 1024 | + methodName: "get_FifthDbContextDummyEntity", |
| 1025 | + methodParameters: "()", |
| 1026 | + }, |
| 1027 | + ], |
| 1028 | + "Volo.Abp.TestApp.MongoDB.CityRepository#FindByNameAsync(System.String)": |
| 1029 | + [ |
| 1030 | + { |
| 1031 | + type: "neutral", |
| 1032 | + kind: "summary", |
| 1033 | + provenance: "df-generated", |
| 1034 | + signature: |
| 1035 | + "Volo.Abp.TestApp.MongoDB.CityRepository#FindByNameAsync(System.String)", |
| 1036 | + packageName: "Volo.Abp.TestApp.MongoDB", |
| 1037 | + typeName: "CityRepository", |
| 1038 | + methodName: "FindByNameAsync", |
| 1039 | + methodParameters: "(System.String)", |
| 1040 | + }, |
| 1041 | + ], |
| 1042 | + }; |
| 1043 | + const modelYaml = `extensions: |
| 1044 | + - addsTo: |
| 1045 | + pack: codeql/csharp-all |
| 1046 | + extensible: sourceModel |
| 1047 | + data: [] |
| 1048 | +
|
| 1049 | + - addsTo: |
| 1050 | + pack: codeql/csharp-all |
| 1051 | + extensible: sinkModel |
| 1052 | + data: |
| 1053 | + - ["Volo.Abp.TestApp.MongoDb","HostTestAppDbContext",true,"get_FifthDbContextDummyEntity","()","","Argument[0]","sql","df-generated"] |
| 1054 | +
|
| 1055 | + - addsTo: |
| 1056 | + pack: codeql/csharp-all |
| 1057 | + extensible: summaryModel |
| 1058 | + data: [] |
| 1059 | +
|
| 1060 | + - addsTo: |
| 1061 | + pack: codeql/csharp-all |
| 1062 | + extensible: neutralModel |
| 1063 | + data: |
| 1064 | + - ["Volo.Abp.TestApp.MongoDB","CityRepository","FindByNameAsync","(System.String)","summary","df-generated"] |
| 1065 | +`; |
| 1066 | + |
| 1067 | + it("creates the correct YAML files when there are existing modeled methods", () => { |
| 1068 | + const yaml = createDataExtensionYamlsForFrameworkMode( |
| 1069 | + QueryLanguage.CSharp, |
| 1070 | + methods, |
| 1071 | + newModeledMethods, |
| 1072 | + {}, |
| 1073 | + ); |
| 1074 | + |
| 1075 | + expect(yaml).toEqual({ |
| 1076 | + "models/Volo.Abp.TestApp.MongoDB.model.yml": modelYaml, |
| 1077 | + }); |
| 1078 | + }); |
| 1079 | + |
| 1080 | + it("creates the correct YAML files when there are existing modeled methods", () => { |
| 1081 | + const yaml = createDataExtensionYamlsForFrameworkMode( |
| 1082 | + QueryLanguage.CSharp, |
| 1083 | + methods, |
| 1084 | + newModeledMethods, |
| 1085 | + { |
| 1086 | + "models/Volo.Abp.TestApp.mongodb.model.yml": { |
| 1087 | + "Volo.Abp.TestApp.MongoDB.CityRepository#FindByNameAsync(System.String)": |
| 1088 | + [ |
| 1089 | + { |
| 1090 | + type: "neutral", |
| 1091 | + kind: "summary", |
| 1092 | + provenance: "manual", |
| 1093 | + signature: |
| 1094 | + "Volo.Abp.TestApp.MongoDB.CityRepository#FindByNameAsync(System.String)", |
| 1095 | + packageName: "Volo.Abp.TestApp.MongoDB", |
| 1096 | + typeName: "CityRepository", |
| 1097 | + methodName: "FindByNameAsync", |
| 1098 | + methodParameters: "(System.String)", |
| 1099 | + }, |
| 1100 | + ], |
| 1101 | + }, |
| 1102 | + }, |
| 1103 | + ); |
| 1104 | + |
| 1105 | + expect(yaml).toEqual({ |
| 1106 | + "models/Volo.Abp.TestApp.mongodb.model.yml": modelYaml, |
| 1107 | + }); |
| 1108 | + }); |
| 1109 | + }); |
983 | 1110 | }); |
984 | 1111 |
|
985 | 1112 | describe("loadDataExtensionYaml", () => { |
|
0 commit comments