|
1 | 1 | import { expect } from 'chai' |
2 | 2 | import { StartTransformRequest, TransformProjectMetadata } from '../models' |
3 | | -import { isProject, isSolution, validateProject, validateSolution } from '../validation' |
| 3 | +import { isProject, isSolution } from '../validation' |
4 | 4 | import { supportedProjects, unsupportedViewComponents } from '../resources/SupportedProjects' |
5 | 5 | import mock = require('mock-fs') |
6 | 6 | import { Logging } from '@aws/language-server-runtimes/server-interface' |
@@ -46,122 +46,4 @@ describe('Test validation functionality', () => { |
46 | 46 | mockStartTransformationRequest.SelectedProjectPath = 'test.csproj' |
47 | 47 | expect(isSolution(mockStartTransformationRequest)).to.equal(false) |
48 | 48 | }) |
49 | | - |
50 | | - it('should return true when project is a supported type', () => { |
51 | | - let mockStartTransformationRequest: StartTransformRequest = sampleStartTransformRequest |
52 | | - const mockProjectMeta = { |
53 | | - Name: '', |
54 | | - ProjectTargetFramework: '', |
55 | | - ProjectPath: 'test.csproj', |
56 | | - SourceCodeFilePaths: [], |
57 | | - ProjectLanguage: '', |
58 | | - ProjectType: 'AspNetCoreMvc', |
59 | | - ExternalReferences: [], |
60 | | - } |
61 | | - mockStartTransformationRequest.ProjectMetadata.push(mockProjectMeta) |
62 | | - |
63 | | - expect(validateProject(mockStartTransformationRequest, mockedLogging)).to.equal(true) |
64 | | - }) |
65 | | - |
66 | | - it('should return false when project is not a supported type', () => { |
67 | | - let mockStartTransformationRequest: StartTransformRequest = sampleStartTransformRequest |
68 | | - const mockProjectMeta = { |
69 | | - Name: '', |
70 | | - ProjectTargetFramework: '', |
71 | | - ProjectPath: 'test.csproj', |
72 | | - SourceCodeFilePaths: [], |
73 | | - ProjectLanguage: '', |
74 | | - ProjectType: 'not supported', |
75 | | - ExternalReferences: [], |
76 | | - } |
77 | | - mockStartTransformationRequest.ProjectMetadata = [] |
78 | | - mockStartTransformationRequest.ProjectMetadata.push(mockProjectMeta) |
79 | | - |
80 | | - expect(validateProject(mockStartTransformationRequest, mockedLogging)).to.equal(false) |
81 | | - }) |
82 | | - |
83 | | - it('should return false when there is no project path that is the same as the selected project path', () => { |
84 | | - let mockStartTransformationRequest: StartTransformRequest = sampleStartTransformRequest |
85 | | - const mockProjectMeta = { |
86 | | - Name: '', |
87 | | - ProjectTargetFramework: '', |
88 | | - ProjectPath: 'different.csproj', |
89 | | - SourceCodeFilePaths: [], |
90 | | - ProjectLanguage: '', |
91 | | - ProjectType: 'AspNetCoreMvc', |
92 | | - ExternalReferences: [], |
93 | | - } |
94 | | - mockStartTransformationRequest.ProjectMetadata = [] |
95 | | - mockStartTransformationRequest.ProjectMetadata.push(mockProjectMeta) |
96 | | - |
97 | | - expect(validateProject(mockStartTransformationRequest, mockedLogging)).to.equal(false) |
98 | | - }) |
99 | | - |
100 | | - // New tests for AspNetWebForms validation |
101 | | - it('should return true when project is AspNetWebForms type', () => { |
102 | | - let mockStartTransformationRequest: StartTransformRequest = sampleStartTransformRequest |
103 | | - const mockProjectMeta = { |
104 | | - Name: '', |
105 | | - ProjectTargetFramework: '', |
106 | | - ProjectPath: 'test.csproj', |
107 | | - SourceCodeFilePaths: [], |
108 | | - ProjectLanguage: '', |
109 | | - ProjectType: 'AspNetWebForms', |
110 | | - ExternalReferences: [], |
111 | | - } |
112 | | - mockStartTransformationRequest.ProjectMetadata = [] |
113 | | - mockStartTransformationRequest.ProjectMetadata.push(mockProjectMeta) |
114 | | - |
115 | | - expect(validateProject(mockStartTransformationRequest, mockedLogging)).to.equal(true) |
116 | | - }) |
117 | | - |
118 | | - it('should not include AspNetWebForms in unsupported projects list', () => { |
119 | | - let mockStartTransformationRequest: StartTransformRequest = sampleStartTransformRequest |
120 | | - |
121 | | - // Add a supported project |
122 | | - const supportedProjectMeta = { |
123 | | - Name: 'Supported', |
124 | | - ProjectTargetFramework: '', |
125 | | - ProjectPath: 'supported.csproj', |
126 | | - SourceCodeFilePaths: [], |
127 | | - ProjectLanguage: '', |
128 | | - ProjectType: 'AspNetCoreMvc', |
129 | | - ExternalReferences: [], |
130 | | - } |
131 | | - |
132 | | - // Add an unsupported project |
133 | | - const unsupportedProjectMeta = { |
134 | | - Name: 'Unsupported', |
135 | | - ProjectTargetFramework: '', |
136 | | - ProjectPath: 'unsupported.csproj', |
137 | | - SourceCodeFilePaths: [], |
138 | | - ProjectLanguage: '', |
139 | | - ProjectType: 'UnsupportedType', |
140 | | - ExternalReferences: [], |
141 | | - } |
142 | | - |
143 | | - // Add an AspNetWebForms project |
144 | | - const webFormsProjectMeta = { |
145 | | - Name: 'WebForms', |
146 | | - ProjectTargetFramework: '', |
147 | | - ProjectPath: 'webforms.csproj', |
148 | | - SourceCodeFilePaths: [], |
149 | | - ProjectLanguage: '', |
150 | | - ProjectType: 'AspNetWebForms', |
151 | | - ExternalReferences: [], |
152 | | - } |
153 | | - |
154 | | - mockStartTransformationRequest.ProjectMetadata = [ |
155 | | - supportedProjectMeta, |
156 | | - unsupportedProjectMeta, |
157 | | - webFormsProjectMeta, |
158 | | - ] |
159 | | - |
160 | | - const unsupportedProjects = validateSolution(mockStartTransformationRequest) |
161 | | - |
162 | | - // Should only contain the unsupported project, not the AspNetWebForms project |
163 | | - expect(unsupportedProjects).to.have.lengthOf(1) |
164 | | - expect(unsupportedProjects[0]).to.equal('unsupported.csproj') |
165 | | - expect(unsupportedProjects).to.not.include('webforms.csproj') |
166 | | - }) |
167 | 49 | }) |
0 commit comments