|
18 | 18 | * permissions and limitations under the License.
|
19 | 19 | */
|
20 | 20 |
|
21 |
| -import { getDataSourceFromUrl, isDataSourceCompatible } from './datasource-utils'; |
| 21 | +import { |
| 22 | + getDataSourceFromUrl, |
| 23 | + isDataSourceCompatible, |
| 24 | + isWLMDataSourceCompatible, |
| 25 | +} from './datasource-utils'; |
22 | 26 |
|
23 | 27 | describe('Tests datasource utils', () => {
|
24 | 28 | it('Tests getting the datasource from the url', () => {
|
@@ -167,4 +171,94 @@ describe('Tests datasource utils', () => {
|
167 | 171 | ).toBe(false);
|
168 | 172 | });
|
169 | 173 | });
|
| 174 | + |
| 175 | + describe('isWLMDataSourceCompatible', () => { |
| 176 | + it('returns true for versions >= 3.1.0', () => { |
| 177 | + expect( |
| 178 | + isWLMDataSourceCompatible({ |
| 179 | + attributes: { |
| 180 | + dataSourceVersion: '3.1.0', |
| 181 | + title: '', |
| 182 | + endpoint: '', |
| 183 | + auth: { type: '', credentials: undefined }, |
| 184 | + }, |
| 185 | + id: '', |
| 186 | + type: '', |
| 187 | + references: [], |
| 188 | + } as any) |
| 189 | + ).toBe(true); |
| 190 | + |
| 191 | + expect( |
| 192 | + isWLMDataSourceCompatible({ |
| 193 | + attributes: { |
| 194 | + dataSourceVersion: '3.3.0', |
| 195 | + title: '', |
| 196 | + endpoint: '', |
| 197 | + auth: { type: '', credentials: undefined }, |
| 198 | + }, |
| 199 | + id: '', |
| 200 | + type: '', |
| 201 | + references: [], |
| 202 | + } as any) |
| 203 | + ).toBe(true); |
| 204 | + }); |
| 205 | + |
| 206 | + it('returns false for versions < 3.1.0 or invalid/pre-release', () => { |
| 207 | + expect( |
| 208 | + isWLMDataSourceCompatible({ |
| 209 | + attributes: { |
| 210 | + dataSourceVersion: '3.0.0', |
| 211 | + title: '', |
| 212 | + endpoint: '', |
| 213 | + auth: { type: '', credentials: undefined }, |
| 214 | + }, |
| 215 | + id: '', |
| 216 | + type: '', |
| 217 | + references: [], |
| 218 | + } as any) |
| 219 | + ).toBe(false); |
| 220 | + |
| 221 | + expect( |
| 222 | + isWLMDataSourceCompatible({ |
| 223 | + attributes: { |
| 224 | + dataSourceVersion: '2.19.0', |
| 225 | + title: '', |
| 226 | + endpoint: '', |
| 227 | + auth: { type: '', credentials: undefined }, |
| 228 | + }, |
| 229 | + id: '', |
| 230 | + type: '', |
| 231 | + references: [], |
| 232 | + } as any) |
| 233 | + ).toBe(false); |
| 234 | + |
| 235 | + expect( |
| 236 | + isWLMDataSourceCompatible({ |
| 237 | + attributes: { |
| 238 | + dataSourceVersion: '', |
| 239 | + title: '', |
| 240 | + endpoint: '', |
| 241 | + auth: { type: '', credentials: undefined }, |
| 242 | + }, |
| 243 | + id: '', |
| 244 | + type: '', |
| 245 | + references: [], |
| 246 | + } as any) |
| 247 | + ).toBe(false); |
| 248 | + |
| 249 | + expect( |
| 250 | + isWLMDataSourceCompatible({ |
| 251 | + attributes: { |
| 252 | + dataSourceVersion: '3.1.0-rc.1', |
| 253 | + title: '', |
| 254 | + endpoint: '', |
| 255 | + auth: { type: '', credentials: undefined }, |
| 256 | + }, |
| 257 | + id: '', |
| 258 | + type: '', |
| 259 | + references: [], |
| 260 | + } as any) |
| 261 | + ).toBe(false); |
| 262 | + }); |
| 263 | + }); |
170 | 264 | });
|
0 commit comments