mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
fix for issue 4596 (#4670)
This commit is contained in:
@@ -66,10 +66,10 @@ suite('Extension Gallery Service', () => {
|
||||
|
||||
assert.equal(ExtensionGalleryService.compareByField(a.publisher, b.publisher, 'publisherName'), 0);
|
||||
|
||||
a.publisher = { displayName: undefined, publisherId: undefined, publisherName: undefined};
|
||||
a.publisher = { displayName: undefined, publisherId: undefined, publisherName: undefined };
|
||||
assert.equal(ExtensionGalleryService.compareByField(a.publisher, b.publisher, 'publisherName'), 1);
|
||||
|
||||
b.publisher = { displayName: undefined, publisherId: undefined, publisherName: undefined};
|
||||
b.publisher = { displayName: undefined, publisherId: undefined, publisherName: undefined };
|
||||
assert.equal(ExtensionGalleryService.compareByField(a.publisher, b.publisher, 'publisherName'), 0);
|
||||
|
||||
a.publisher.publisherName = 'a';
|
||||
@@ -90,4 +90,61 @@ suite('Extension Gallery Service', () => {
|
||||
b.displayName = 'test1';
|
||||
assert.equal(ExtensionGalleryService.compareByField(a, b, 'displayName'), 0);
|
||||
});
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
test('isMatchingExtension', () => {
|
||||
let createEmptyExtension = () => {
|
||||
return {
|
||||
extensionId: '',
|
||||
extensionName: '',
|
||||
displayName: '',
|
||||
shortDescription: '',
|
||||
publisher: {
|
||||
displayName: '',
|
||||
publisherId: '',
|
||||
publisherName: ''
|
||||
},
|
||||
versions: [],
|
||||
statistics: [],
|
||||
flags: ''
|
||||
};
|
||||
};
|
||||
let searchText = 'tExt1 withSpace';
|
||||
let matchingText = 'test text1 Withspace test';
|
||||
let notMatchingText = 'test test';
|
||||
let extension;
|
||||
|
||||
assert(!ExtensionGalleryService.isMatchingExtension(undefined, searchText), 'empty extension should not match any search text');
|
||||
|
||||
extension = createEmptyExtension();
|
||||
assert(ExtensionGalleryService.isMatchingExtension(extension, undefined), 'empty search text should match any not null extension');
|
||||
|
||||
extension = createEmptyExtension();
|
||||
extension.extensionName = notMatchingText;
|
||||
assert(!ExtensionGalleryService.isMatchingExtension(extension, searchText), 'invalid search text should not match extension');
|
||||
|
||||
extension = createEmptyExtension();
|
||||
extension.extensionId = matchingText;
|
||||
assert(ExtensionGalleryService.isMatchingExtension(extension, searchText), 'extensionid field should be used for matching');
|
||||
|
||||
extension = createEmptyExtension();
|
||||
extension.extensionName = matchingText;
|
||||
assert(ExtensionGalleryService.isMatchingExtension(extension, searchText), 'extensionName field should be used for matching');
|
||||
|
||||
extension = createEmptyExtension();
|
||||
extension.displayName = matchingText;
|
||||
assert(ExtensionGalleryService.isMatchingExtension(extension, searchText), 'displayName field should be used for matching');
|
||||
|
||||
extension = createEmptyExtension();
|
||||
extension.shortDescription = matchingText;
|
||||
assert(ExtensionGalleryService.isMatchingExtension(extension, searchText), 'shortDescription field should be used for matching');
|
||||
|
||||
extension = createEmptyExtension();
|
||||
extension.publisher.displayName = matchingText;
|
||||
assert(ExtensionGalleryService.isMatchingExtension(extension, searchText), 'publisher displayName field should be used for matching');
|
||||
|
||||
extension = createEmptyExtension();
|
||||
extension.publisher.publisherName = matchingText;
|
||||
assert(ExtensionGalleryService.isMatchingExtension(extension, searchText), 'publisher publisherName field should be used for matching');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user