diff --git a/examples/api-tests/src/file-search.spec.js b/examples/api-tests/src/file-search.spec.js index 80ca3bbde716c..196abe1e59b92 100644 --- a/examples/api-tests/src/file-search.spec.js +++ b/examples/api-tests/src/file-search.spec.js @@ -20,7 +20,6 @@ describe('file-search', function () { const { assert } = chai; const Uri = require('@theia/core/lib/common/uri'); - const { QuickOpenItem } = require('@theia/core/lib/browser'); const { QuickFileOpenService } = require('@theia/file-search/lib/browser/quick-file-open'); /** @type {import('inversify').Container} */ @@ -32,25 +31,31 @@ describe('file-search', function () { describe('#compareItems', () => { it('should compare two quick-open-items by `label`', () => { - const a = new QuickOpenItem({ label: 'a', uri: new Uri.default('a') }); - const b = new QuickOpenItem({ label: 'a', uri: new Uri.default('b') }); + + /** @type monaco.quickInput.IAnythingQuickPickItem */ + const a = { label: 'a', resource: new Uri.default('a') }; + /** @type monaco.quickInput.IAnythingQuickPickItem */ + const b = { label: 'a', resource: new Uri.default('b') }; assert.equal(quickFileOpenService['compareItems'](a, b), 1, 'a should be before b'); assert.equal(quickFileOpenService['compareItems'](b, a), -1, 'a should be before b'); assert.equal(quickFileOpenService['compareItems'](a, a), 0, 'items should be equal'); - assert.equal(quickFileOpenService['compareItems'](a, b, 'getLabel'), 1, 'a should be before b'); - assert.equal(quickFileOpenService['compareItems'](b, a, 'getLabel'), -1, 'a should be before b'); - assert.equal(quickFileOpenService['compareItems'](a, a, 'getLabel'), 0, 'items should be equal'); + assert.equal(quickFileOpenService['compareItems'](a, b, 'label'), 1, 'a should be before b'); + assert.equal(quickFileOpenService['compareItems'](b, a, 'label'), -1, 'a should be before b'); + assert.equal(quickFileOpenService['compareItems'](a, a, 'label'), 0, 'items should be equal'); }); it('should compare two quick-open-items by `uri`', () => { - const a = new QuickOpenItem({ label: 'a', uri: new Uri.default('a') }); - const b = new QuickOpenItem({ label: 'a', uri: new Uri.default('b') }); - assert.equal(quickFileOpenService['compareItems'](a, b, 'getUri'), 1, 'a should be before b'); - assert.equal(quickFileOpenService['compareItems'](b, a, 'getUri'), -1, 'a should be before b'); - assert.equal(quickFileOpenService['compareItems'](a, a, 'getUri'), 0, 'items should be equal'); + /** @type monaco.quickInput.IAnythingQuickPickItem */ + const a = { label: 'a', resource: new Uri.default('a') }; + /** @type monaco.quickInput.IAnythingQuickPickItem */ + const b = { label: 'a', resource: new Uri.default('b') }; + + assert.equal(quickFileOpenService['compareItems'](a, b, 'resource'), 1, 'a should be before b'); + assert.equal(quickFileOpenService['compareItems'](b, a, 'resource'), -1, 'a should be before b'); + assert.equal(quickFileOpenService['compareItems'](a, a, 'resource'), 0, 'items should be equal'); }); });