@verdaccio/store 6.0.0-6-next.20 → 6.0.0-6-next.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/build/local-storage.js +6 -0
- package/build/local-storage.js.map +1 -1
- package/build/search.d.ts +0 -43
- package/build/search.js +31 -142
- package/build/search.js.map +1 -1
- package/build/storage-utils.js +1 -5
- package/build/storage-utils.js.map +1 -1
- package/build/storage.js +2 -10
- package/build/storage.js.map +1 -1
- package/package.json +12 -15
- package/src/local-storage.ts +6 -0
- package/src/search.ts +21 -124
- package/src/storage-utils.ts +1 -5
- package/src/storage.ts +2 -9
- package/test/search.spec.ts +0 -65
- package/test/storage.spec.ts +1 -1
package/test/search.spec.ts
CHANGED
|
@@ -6,7 +6,6 @@ import { setup } from '@verdaccio/logger';
|
|
|
6
6
|
import { configExample } from '@verdaccio/mock';
|
|
7
7
|
|
|
8
8
|
import { Storage, removeDuplicates } from '../src';
|
|
9
|
-
import { SearchInstance } from '../src/search';
|
|
10
9
|
|
|
11
10
|
setup([]);
|
|
12
11
|
|
|
@@ -53,68 +52,4 @@ describe('search', () => {
|
|
|
53
52
|
expect(results).toHaveLength(4);
|
|
54
53
|
});
|
|
55
54
|
});
|
|
56
|
-
|
|
57
|
-
describe('search index', () => {
|
|
58
|
-
const packages = [
|
|
59
|
-
{
|
|
60
|
-
name: 'test1',
|
|
61
|
-
description: 'description',
|
|
62
|
-
_npmUser: {
|
|
63
|
-
name: 'test_user',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
name: 'test2',
|
|
68
|
-
description: 'description',
|
|
69
|
-
_npmUser: {
|
|
70
|
-
name: 'test_user',
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
name: 'test3',
|
|
75
|
-
description: 'description',
|
|
76
|
-
_npmUser: {
|
|
77
|
-
name: 'test_user',
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
];
|
|
81
|
-
|
|
82
|
-
test('search query item', async () => {
|
|
83
|
-
const config = new Config(configExample());
|
|
84
|
-
const storage = new Storage(config);
|
|
85
|
-
await storage.init(config);
|
|
86
|
-
SearchInstance.configureStorage(storage);
|
|
87
|
-
packages.map(function (item) {
|
|
88
|
-
// @ts-ignore
|
|
89
|
-
SearchInstance.add(item);
|
|
90
|
-
});
|
|
91
|
-
const result = SearchInstance.query('t');
|
|
92
|
-
expect(result).toHaveLength(3);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
test('search remove item', async () => {
|
|
96
|
-
const config = new Config(configExample());
|
|
97
|
-
const storage = new Storage(config);
|
|
98
|
-
await storage.init(config);
|
|
99
|
-
SearchInstance.configureStorage(storage);
|
|
100
|
-
packages.map(function (item) {
|
|
101
|
-
// @ts-ignore
|
|
102
|
-
SearchInstance.add(item);
|
|
103
|
-
});
|
|
104
|
-
const item = {
|
|
105
|
-
name: 'test6',
|
|
106
|
-
description: 'description',
|
|
107
|
-
_npmUser: {
|
|
108
|
-
name: 'test_user',
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
// @ts-ignore
|
|
112
|
-
SearchInstance.add(item);
|
|
113
|
-
let result = SearchInstance.query('test6');
|
|
114
|
-
expect(result).toHaveLength(1);
|
|
115
|
-
SearchInstance.remove(item.name);
|
|
116
|
-
result = SearchInstance.query('test6');
|
|
117
|
-
expect(result).toHaveLength(0);
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
55
|
});
|
package/test/storage.spec.ts
CHANGED
|
@@ -3,9 +3,9 @@ import * as httpMocks from 'node-mocks-http';
|
|
|
3
3
|
|
|
4
4
|
import { Config } from '@verdaccio/config';
|
|
5
5
|
import { HEADERS, errorUtils } from '@verdaccio/core';
|
|
6
|
-
import { generatePackageMetadata } from '@verdaccio/helper';
|
|
7
6
|
import { setup } from '@verdaccio/logger';
|
|
8
7
|
import { configExample, generateRamdonStorage } from '@verdaccio/mock';
|
|
8
|
+
import { generatePackageMetadata } from '@verdaccio/test-helper';
|
|
9
9
|
|
|
10
10
|
import { Storage } from '../src';
|
|
11
11
|
|