@verdaccio/proxy 8.0.0-next-8.12 → 8.0.0-next-8.13

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.
@@ -1,31 +0,0 @@
1
- storage: ./storage
2
- plugins: ./plugins
3
- web:
4
- title: Verdaccio
5
- auth:
6
- htpasswd:
7
- file: ./htpasswd
8
- uplinks:
9
- npmjs:
10
- url: https://registry.npmjs.org/
11
-
12
- packages:
13
- '@*/*':
14
- access: $all
15
- publish: $authenticated
16
- unpublish: $authenticated
17
- proxy: npmjs
18
-
19
- '**':
20
- access: $all
21
- publish: $authenticated
22
- unpublish: $authenticated
23
- proxy: npmjs
24
-
25
- server:
26
- keepAliveTimeout: 60
27
-
28
- middlewares:
29
- audit:
30
- enabled: true
31
- log: { type: stdout, format: pretty, level: http }
@@ -1,165 +0,0 @@
1
- import { describe, expect, test, vi } from 'vitest';
2
-
3
- import { DEFAULT_REGISTRY } from '@verdaccio/config';
4
- import { HEADERS, TOKEN_BASIC, TOKEN_BEARER, constants } from '@verdaccio/core';
5
- import { Logger } from '@verdaccio/types';
6
- import { buildToken } from '@verdaccio/utils';
7
-
8
- import { ProxyStorage } from '../src';
9
-
10
- const mockDebug = vi.fn();
11
- const mockInfo = vi.fn();
12
- const mockHttp = vi.fn();
13
- const mockError = vi.fn();
14
- const mockWarn = vi.fn();
15
-
16
- const logger = {
17
- debug: mockDebug,
18
- info: mockInfo,
19
- http: mockHttp,
20
- error: mockError,
21
- warn: mockWarn,
22
- } as unknown as Logger;
23
-
24
- function createUplink(config) {
25
- const defaultConfig = {
26
- url: DEFAULT_REGISTRY,
27
- };
28
- const mergeConfig = Object.assign({}, defaultConfig, config);
29
- // @ts-ignore
30
- return new ProxyStorage(mergeConfig, {}, logger);
31
- }
32
-
33
- function setHeadersNext(config: unknown = {}, headers: any = {}) {
34
- const uplink = createUplink(config);
35
- return uplink.getHeaders({ ...headers });
36
- }
37
-
38
- describe('setHeadersNext', () => {
39
- test('if set headers empty should return default headers', () => {
40
- const headers = setHeadersNext();
41
- const keys = Object.keys(headers);
42
- const keysExpected = [HEADERS.ACCEPT, HEADERS.ACCEPT_ENCODING, HEADERS.USER_AGENT];
43
-
44
- expect(keys).toEqual(keysExpected);
45
- expect(keys).toHaveLength(3);
46
- });
47
-
48
- test('if assigns value invalid to attribute auth', () => {
49
- const fnError = function () {
50
- setHeadersNext({
51
- auth: '',
52
- });
53
- };
54
-
55
- expect(function () {
56
- fnError();
57
- }).toThrow(Error('Auth invalid'));
58
- });
59
-
60
- test('if assigns the header authorization', () => {
61
- const headers = setHeadersNext(
62
- {},
63
- {
64
- [HEADERS.AUTHORIZATION]: buildToken(TOKEN_BASIC, 'Zm9vX2Jhcg=='),
65
- }
66
- );
67
-
68
- expect(Object.keys(headers)).toHaveLength(4);
69
- expect(headers[HEADERS.AUTHORIZATION]).toEqual(buildToken(TOKEN_BASIC, 'Zm9vX2Jhcg=='));
70
- });
71
-
72
- test('if assigns headers authorization and token the header precedes', () => {
73
- const headers = setHeadersNext(
74
- {
75
- auth: {
76
- type: TOKEN_BEARER,
77
- token: 'tokenBearer',
78
- },
79
- },
80
- {
81
- [HEADERS.AUTHORIZATION]: buildToken(TOKEN_BASIC, 'tokenBasic'),
82
- }
83
- );
84
-
85
- expect(headers[HEADERS.AUTHORIZATION]).toEqual(buildToken(TOKEN_BASIC, 'tokenBasic'));
86
- });
87
-
88
- test('set type auth basic', () => {
89
- const headers = setHeadersNext({
90
- auth: {
91
- type: TOKEN_BASIC,
92
- token: 'Zm9vX2Jhcg==',
93
- },
94
- });
95
-
96
- expect(Object.keys(headers)).toHaveLength(4);
97
- expect(headers[HEADERS.AUTHORIZATION]).toEqual(buildToken(TOKEN_BASIC, 'Zm9vX2Jhcg=='));
98
- });
99
-
100
- test('set type auth bearer', () => {
101
- const headers = setHeadersNext({
102
- auth: {
103
- type: TOKEN_BEARER,
104
- token: 'Zm9vX2Jhcf===',
105
- },
106
- });
107
-
108
- expect(Object.keys(headers)).toHaveLength(4);
109
- expect(headers[HEADERS.AUTHORIZATION]).toEqual(buildToken(TOKEN_BEARER, 'Zm9vX2Jhcf==='));
110
- });
111
-
112
- test('set auth type invalid', () => {
113
- const fnError = function () {
114
- setHeadersNext({
115
- auth: {
116
- type: 'null',
117
- token: 'Zm9vX2Jhcf===',
118
- },
119
- });
120
- };
121
-
122
- expect(function () {
123
- fnError();
124
- }).toThrow(Error(`Auth type 'null' not allowed`));
125
- });
126
-
127
- test('set auth with NPM_TOKEN', () => {
128
- process.env.NPM_TOKEN = 'myToken';
129
- const headers = setHeadersNext({
130
- auth: {
131
- type: TOKEN_BEARER,
132
- },
133
- });
134
-
135
- expect(headers[HEADERS.AUTHORIZATION]).toBe(buildToken(TOKEN_BEARER, 'myToken'));
136
- delete process.env.NPM_TOKEN;
137
- });
138
-
139
- test('set auth with token name and assigns in env', () => {
140
- process.env.NPM_TOKEN_TEST = 'myTokenTest';
141
- const headers = setHeadersNext({
142
- auth: {
143
- type: TOKEN_BASIC,
144
- token_env: 'NPM_TOKEN_TEST',
145
- },
146
- });
147
-
148
- expect(headers[HEADERS.AUTHORIZATION]).toBe(buildToken(TOKEN_BASIC, 'myTokenTest'));
149
- delete process.env.NPM_TOKEN_TEST;
150
- });
151
-
152
- test('if token not set', () => {
153
- const fnError = function () {
154
- setHeadersNext({
155
- auth: {
156
- type: TOKEN_BASIC,
157
- },
158
- });
159
- };
160
-
161
- expect(function () {
162
- fnError();
163
- }).toThrow(constants.ERROR_CODE.token_required);
164
- });
165
- });
@@ -1,239 +0,0 @@
1
- import { describe, expect, test } from 'vitest';
2
-
3
- import { logger, setup } from '@verdaccio/logger';
4
-
5
- import { ProxyStorage } from '../src';
6
-
7
- setup({});
8
-
9
- function getProxyInstance(host, uplinkConf, appConfig) {
10
- uplinkConf.url = host;
11
-
12
- return new ProxyStorage(uplinkConf, appConfig, logger);
13
- }
14
-
15
- describe('Use proxy', () => {
16
- describe('basic tets', () => {
17
- test('should do not define proxy', () => {
18
- const x = getProxyInstance('http://registry.domain.org', {}, {});
19
-
20
- expect(x.proxy).toEqual(undefined);
21
- });
22
-
23
- test('uplink configuration should take priority', () => {
24
- expect(
25
- getProxyInstance(
26
- 'http://registry.domain.org',
27
- { http_proxy: 'http:\\registry.local.org' },
28
- { http_proxy: 'registry.domain.org' }
29
- ).proxy
30
- ).toEqual('http:\\registry.local.org');
31
- });
32
-
33
- test('global configuration should be used', () => {
34
- expect(
35
- getProxyInstance(
36
- 'http://registry.some.org',
37
- {},
38
- { http_proxy: 'http://registry.domain.org' }
39
- ).proxy
40
- ).toEqual('http://registry.domain.org');
41
- });
42
- });
43
-
44
- describe('no_proxy invalid cases', () => {
45
- test('no_proxy is null', () => {
46
- let x = getProxyInstance(
47
- 'http://x/x',
48
- { http_proxy: 'http:\\registry.local.org', no_proxy: null },
49
- {}
50
- );
51
- expect(x.proxy).toEqual('http:\\registry.local.org');
52
- });
53
-
54
- test('no_proxy is empty array', () => {
55
- let x = getProxyInstance(
56
- 'http://x/x',
57
- { http_proxy: 'http:\\registry.local.org', no_proxy: [] },
58
- {}
59
- );
60
- expect(x.proxy).toEqual('http:\\registry.local.org');
61
- });
62
-
63
- test('no_proxy is empty object', () => {
64
- let x = getProxyInstance(
65
- 'http://x/x',
66
- { http_proxy: 'http:\\registry.local.org', no_proxy: '' },
67
- {}
68
- );
69
- expect(x.proxy).toEqual('http:\\registry.local.org');
70
- });
71
-
72
- test('no_proxy - simple/include', () => {
73
- let x = getProxyInstance(
74
- 'http://localhost',
75
- { http_proxy: 'http:\\registry.local.org' },
76
- { no_proxy: 'localhost' }
77
- );
78
-
79
- expect(x.proxy).toEqual(undefined);
80
- });
81
-
82
- test('no_proxy - simple/not', () => {
83
- let x = getProxyInstance(
84
- 'http://localhost',
85
- { http_proxy: 'http:\\registry.local.org' },
86
- { no_proxy: 'blah' }
87
- );
88
-
89
- expect(x.proxy).toEqual('http:\\registry.local.org');
90
- });
91
-
92
- test('no_proxy is boolean', () => {
93
- let x = getProxyInstance(
94
- 'http://registry.some.domain',
95
- { http_proxy: 'http:\\registry.local.org', no_proxy: false },
96
- {}
97
- );
98
- expect(x.proxy).toEqual('http:\\registry.local.org');
99
- });
100
- });
101
-
102
- describe('no_proxy override http_proxy use cases', () => {
103
- test('no_proxy - various, single string', () => {
104
- let x = getProxyInstance(
105
- 'http://blahblah',
106
- { http_proxy: 'http:\\registry.local.org' },
107
- { no_proxy: 'blah' }
108
- );
109
-
110
- expect(x.proxy).toEqual('http:\\registry.local.org');
111
- });
112
- test('should disable proxy if match hostname', () => {
113
- let x = getProxyInstance(
114
- 'http://registry.local.org',
115
- {},
116
- { http_proxy: 'http:\\registry.local.org', no_proxy: 'registry.local.org' }
117
- );
118
- expect(x.proxy).toEqual(undefined);
119
- });
120
- test('should not override http_proxy if domain does not match', () => {
121
- let x = getProxyInstance(
122
- 'http://blahblah',
123
- {},
124
- { http_proxy: 'http://registry.local.org', no_proxy: '.blah' }
125
- );
126
- expect(x.proxy).toEqual('http://registry.local.org');
127
- });
128
- test('should override http_proxy if match domain no_proxy', () => {
129
- let x = getProxyInstance('http://blah.blah', { http_proxy: '123', no_proxy: '.blah' }, {});
130
- expect(x.proxy).toEqual(undefined);
131
- });
132
- test('should override http_proxy due no_proxy match with hostname', () => {
133
- let x = getProxyInstance('http://blah', { http_proxy: '123', no_proxy: '.blah' }, {});
134
- expect(x.proxy).toEqual(undefined);
135
- });
136
- test('should not override http_proxy if no_proxy does not match', () => {
137
- let x = getProxyInstance(
138
- 'http://blahh',
139
- { http_proxy: 'http://registry.local.org', no_proxy: 'blah' },
140
- {}
141
- );
142
- expect(x.proxy).toEqual('http://registry.local.org');
143
- });
144
- });
145
- describe('no_proxy as array of domains', () => {
146
- test('should not override http_proxy if not match domain', () => {
147
- let x = getProxyInstance(
148
- 'http://blahblah',
149
- { http_proxy: 'http:\\registry.local.org' },
150
- { no_proxy: 'foo,bar,blah' }
151
- );
152
-
153
- expect(x.proxy).toEqual('http:\\registry.local.org');
154
- });
155
- test('should disable proxy if match domain', () => {
156
- let x = getProxyInstance(
157
- 'http://blah.blah',
158
- { http_proxy: 'http:\\registry.local.org' },
159
- { no_proxy: 'foo,bar,blah' }
160
- );
161
- expect(x.proxy).toEqual(undefined);
162
- });
163
-
164
- test('disable proxy if match domain .foo', () => {
165
- let x = getProxyInstance(
166
- 'http://blah.foo',
167
- { http_proxy: 'http:\\registry.local.org' },
168
- { no_proxy: 'foo,bar,blah' }
169
- );
170
- expect(x.proxy).toEqual(undefined);
171
- });
172
- test('should not disable http_proxy if not match domain', () => {
173
- let x = getProxyInstance(
174
- 'http://foo.baz',
175
- { http_proxy: 'http:\\registry.local.org' },
176
- { no_proxy: 'foo,bar,blah' }
177
- );
178
- expect(x.proxy).toEqual('http:\\registry.local.org');
179
- });
180
- test('no_proxy should not find match no_proxy as array invalid domains', () => {
181
- let x = getProxyInstance(
182
- 'http://blahblah',
183
- { http_proxy: 'http:\\registry.local.org' },
184
- { no_proxy: ['foo', 'bar', 'blah'] }
185
- );
186
- expect(x.proxy).toEqual('http:\\registry.local.org');
187
- });
188
- test('no_proxy should find match no_proxy as array valid domains', () => {
189
- let x = getProxyInstance(
190
- 'http://blah.blah',
191
- { http_proxy: 'http:\\registry.local.org' },
192
- { no_proxy: ['foo', 'bar', 'blah'] }
193
- );
194
- expect(x.proxy).toEqual(undefined);
195
- });
196
- });
197
-
198
- describe('no_proxy with ports', () => {
199
- test('no_proxy - hostport', () => {
200
- let x = getProxyInstance(
201
- 'http://localhost:80',
202
- { http_proxy: '123' },
203
- { no_proxy: 'localhost' }
204
- );
205
-
206
- expect(x.proxy).toEqual(undefined);
207
- x = getProxyInstance(
208
- 'http://localhost:8080',
209
- { http_proxy: '123' },
210
- { no_proxy: 'localhost' }
211
- );
212
- expect(x.proxy).toEqual(undefined);
213
- });
214
- });
215
-
216
- describe('no_proxy with https match', () => {
217
- test('should not override if https_proxy is defined', () => {
218
- let x = getProxyInstance('https://something', { http_proxy: '123' }, {});
219
-
220
- expect(x.proxy).toEqual(undefined);
221
- });
222
- test('should define proxy if https_proxy match', () => {
223
- let x = getProxyInstance(
224
- 'https://something',
225
- { https_proxy: 'https://registry.local.org' },
226
- {}
227
- );
228
- expect(x.proxy).toEqual('https://registry.local.org');
229
- });
230
- test('should match https_proxy if https protocol match', () => {
231
- let x = getProxyInstance(
232
- 'https://something',
233
- { http_proxy: 'http://registry.local.org', https_proxy: 'https://registry.local.org' },
234
- {}
235
- );
236
- expect(x.proxy).toEqual('https://registry.local.org');
237
- });
238
- });
239
- });
Binary file
@@ -1,157 +0,0 @@
1
- {
2
- "objects": [
3
- {
4
- "package": {
5
- "name": "verdaccio",
6
- "scope": "unscoped",
7
- "version": "5.1.2",
8
- "description": "A lightweight private npm proxy registry",
9
- "keywords": [
10
- "private",
11
- "package",
12
- "repository",
13
- "registry",
14
- "enterprise",
15
- "modules",
16
- "proxy",
17
- "server",
18
- "verdaccio"
19
- ],
20
- "date": "2021-07-14T18:26:48.823Z",
21
- "links": {
22
- "npm": "https://www.npmjs.com/package/verdaccio",
23
- "homepage": "https://verdaccio.org",
24
- "repository": "https://github.com/verdaccio/verdaccio",
25
- "bugs": "https://github.com/verdaccio/verdaccio/issues"
26
- },
27
- "author": {
28
- "name": "Verdaccio Maintainers",
29
- "email": "verdaccio.npm@gmail.com",
30
- "username": "verdaccio.npm"
31
- },
32
- "publisher": { "username": "verdaccio.npm", "email": "verdaccio.npm@gmail.com" },
33
- "maintainers": [
34
- { "username": "jotadeveloper", "email": "juanpicado19@gmail.com" },
35
- { "username": "ayusharma", "email": "ayush.aceit@gmail.com" },
36
- { "username": "trentearl", "email": "trent@trentearl.com" },
37
- { "username": "jmwilkinson", "email": "J.Wilkinson@f5.com" },
38
- { "username": "sergiohgz", "email": "sergio@sergiohgz.eu" },
39
- { "username": "verdaccio.npm", "email": "verdaccio.npm@gmail.com" }
40
- ]
41
- },
42
- "score": {
43
- "final": 0.38839042352668346,
44
- "detail": {
45
- "quality": 0.6389690936404147,
46
- "popularity": 0.22866579647969262,
47
- "maintenance": 0.3333333333333333
48
- }
49
- },
50
- "searchScore": 100000.375
51
- },
52
- {
53
- "package": {
54
- "name": "verdaccio-bitbucket",
55
- "scope": "unscoped",
56
- "version": "3.0.1",
57
- "description": "Verdaccio module to authenticate users via Bitbucket",
58
- "keywords": [
59
- "sinopia",
60
- "verdaccio",
61
- "bitbucket",
62
- "atlassian",
63
- "auth",
64
- "node",
65
- "nodejs",
66
- "js",
67
- "javascript"
68
- ],
69
- "date": "2020-11-17T18:31:50.893Z",
70
- "links": { "npm": "https://www.npmjs.com/package/verdaccio-bitbucket" },
71
- "author": {
72
- "name": "Idan Gozlan",
73
- "email": "idangozlan@gmail.com",
74
- "username": "idangozlan"
75
- },
76
- "publisher": { "username": "idangozlan", "email": "idangozlan@gmail.com" },
77
- "maintainers": [{ "username": "idangozlan", "email": "idangozlan@gmail.com" }]
78
- },
79
- "score": {
80
- "final": 0.3676150990565089,
81
- "detail": {
82
- "quality": 0.9333033508158308,
83
- "popularity": 0.005251300076726234,
84
- "maintenance": 0.2451032536711585
85
- }
86
- },
87
- "searchScore": 0.00029462433
88
- },
89
- {
90
- "package": {
91
- "name": "verdaccio-badger",
92
- "scope": "unscoped",
93
- "version": "1.0.0",
94
- "description": "verdaccio middleware plugin to serve svg badges",
95
- "keywords": ["verdaccio", "plugin", "middleware", "badge", "badges"],
96
- "date": "2020-08-02T18:08:10.321Z",
97
- "links": {
98
- "npm": "https://www.npmjs.com/package/verdaccio-badger",
99
- "homepage": "https://github.com/PaddeK/verdaccio-badger",
100
- "repository": "https://github.com/PaddeK/verdaccio-badger",
101
- "bugs": "https://github.com/PaddeK/verdaccio-badger/issues"
102
- },
103
- "author": { "name": "Patrick Klös", "email": "pkloes@web.de", "username": "paddek" },
104
- "publisher": { "username": "paddek", "email": "pkloes@web.de" },
105
- "maintainers": [{ "username": "paddek", "email": "pkloes@web.de" }]
106
- },
107
- "score": {
108
- "final": 0.3595405976501428,
109
- "detail": {
110
- "quality": 0.920245406776651,
111
- "popularity": 0.0027140305161327217,
112
- "maintenance": 0.23576304267571743
113
- }
114
- },
115
- "searchScore": 0.00022687363
116
- },
117
- {
118
- "package": {
119
- "name": "@verdaccio/streams",
120
- "scope": "verdaccio",
121
- "version": "10.0.0",
122
- "description": "Stream extension for Verdaccio",
123
- "keywords": ["verdaccio", "streams"],
124
- "date": "2021-03-29T13:01:49.263Z",
125
- "links": {
126
- "npm": "https://www.npmjs.com/package/%40verdaccio%2Fstreams",
127
- "homepage": "https://verdaccio.org",
128
- "repository": "https://github.com/verdaccio/monorepo",
129
- "bugs": "https://github.com/verdaccio/monorepo/issues"
130
- },
131
- "author": {
132
- "name": "Juan Picado",
133
- "email": "juanpicado19@gmail.com",
134
- "username": "jotadeveloper"
135
- },
136
- "publisher": { "username": "verdaccio.npm", "email": "verdaccio.npm@gmail.com" },
137
- "maintainers": [
138
- { "username": "sergiohgz", "email": "sergio@sergiohgz.eu" },
139
- { "username": "verdaccio.npm", "email": "verdaccio.npm@gmail.com" },
140
- { "username": "jotadeveloper", "email": "juanpicado19@gmail.com" },
141
- { "username": "ayusharma", "email": "ayush.aceit@gmail.com" }
142
- ]
143
- },
144
- "score": {
145
- "final": 0.34805712275547446,
146
- "detail": {
147
- "quality": 0.6324693223008875,
148
- "popularity": 0.11950424927689082,
149
- "maintenance": 0.3328281109094184
150
- }
151
- },
152
- "searchScore": 0.00015023774
153
- }
154
- ],
155
- "total": 218,
156
- "time": "Sun Jul 25 2021 14:11:11 GMT+0000 (Coordinated Universal Time)"
157
- }
@@ -1,15 +0,0 @@
1
- -----BEGIN RSA PRIVATE KEY-----
2
- MIICWwIBAAKBgQCzURxIqzer0ACAbX/lHdsn4Gd9PLKrf7EeDYfIdV0HZKPD8WDr
3
- bBx2/fBu0OW2sjnzv/SVZbJ0DAuPE/p0+eT0qb2qC10iz9iTD7ribd7gxhirVb8y
4
- b3fBjXsxc8V8p4Ny1LcvNSqCjwUbJqdRogfoJeTiqPM58z5sNzuv5iq7iwIDAQAB
5
- AoGAPMQy4olrP0UotlzlJ36bowLP70ffgHCwU+/f4NWs5fF78c3du0oSx1w820Dd
6
- Z7E0JF8bgnlJJTxjumPZz0RUCugrEHBKJmzEz3cxF5E3+7NvteZcjKn9D67RrM5x
7
- 1/uSZ9cqKE9cYvY4fSuHx18diyZ4axR/wB1Pea2utjjDM+ECQQDb9ZbmmaWMiRpQ
8
- 5Up+loxP7BZNPsEVsm+DVJmEFbaFgGfncWBqSIqnPNjMwTwj0OigTwCAEGPkfRVW
9
- T0pbYWCxAkEA0LK7SCTwzyDmhASUalk0x+3uCAA6ryFdwJf/wd8TRAvVOmkTEldX
10
- uJ7ldLvfrONYO3v56uKTU/SoNdZYzKtO+wJAX2KM4ctXYy5BXztPpr2acz4qHa1N
11
- Bh+vBAC34fOYhyQ76r3b1btHhWZ5jbFuZwm9F2erC94Ps5IaoqcX07DSwQJAPKGw
12
- h2U0EPkd/3zVIZCJJQya+vgWFIs9EZcXVtvYXQyTBkVApTN66MhBIYjzkub5205J
13
- bVQmOV37AKklY1DhwQJAA1wos0cYxro02edzatxd0DIR2r4qqOqLkw6BhYHhq6HJ
14
- ZvIcQkHqdSXzdETFc01I1znDGGIrJHcnvKWgBPoEUg==
15
- -----END RSA PRIVATE KEY-----
@@ -1,12 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIB1TCCAT4CCQDV5mPlzm9+izANBgkqhkiG9w0BAQUFADAvMS0wKwYDVQQDEyQ3
3
- NTI3YmQ3Ny1hYjNlLTQ3NGItYWNlNy1lZWQ2MDUzOTMxZTcwHhcNMTUwNzA2MjI0
4
- NTA3WhcNMjUwNzAzMjI0NTA3WjAvMS0wKwYDVQQDEyQ3NTI3YmQ3Ny1hYjNlLTQ3
5
- NGItYWNlNy1lZWQ2MDUzOTMxZTcwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB
6
- ALNRHEirN6vQAIBtf+Ud2yfgZ308sqt/sR4Nh8h1XQdko8PxYOtsHHb98G7Q5bay
7
- OfO/9JVlsnQMC48T+nT55PSpvaoLXSLP2JMPuuJt3uDGGKtVvzJvd8GNezFzxXyn
8
- g3LUty81KoKPBRsmp1GiB+gl5OKo8znzPmw3O6/mKruLAgMBAAEwDQYJKoZIhvcN
9
- AQEFBQADgYEACzoHUF8UV2Z6541Q2wKEA0UFUzmUjf/E1XwBO+1P15ZZ64uw34B4
10
- 1RwMPtAo9RY/PmICTWtNxWGxkzwb2JtDWtnxVER/lF8k2XcXPE76fxTHJF/BKk9J
11
- QU8OTD1dd9gHCBviQB9TqntRZ5X7axjtuWjb2umY+owBYzAHZkp1HKI=
12
- -----END CERTIFICATE-----
@@ -1,36 +0,0 @@
1
- import assert from 'assert';
2
- import { describe, test } from 'vitest';
3
-
4
- import { parseInterval } from '../src/proxy-utils';
5
-
6
- describe('Parse interval', () => {
7
- function addTest(str, res) {
8
- test('parse ' + str, () => {
9
- if (res === null) {
10
- assert.throws(function () {
11
- // eslint-disable-next-line no-console
12
- console.log(parseInterval(str));
13
- });
14
- } else {
15
- assert.strictEqual(parseInterval(str), res);
16
- }
17
- });
18
- }
19
-
20
- addTest(12345, 12345000);
21
- addTest('1000', 1000000);
22
- addTest('1.5s', 1500);
23
- addTest('25ms', 25);
24
- addTest('2m', 2 * 1000 * 60);
25
- addTest('3h', 3 * 1000 * 60 * 60);
26
- addTest('0.5d', 0.5 * 1000 * 60 * 60 * 24);
27
- addTest('0.5w', 0.5 * 1000 * 60 * 60 * 24 * 7);
28
- addTest('1M', 1000 * 60 * 60 * 24 * 30);
29
- addTest('5s 20ms', 5020);
30
- addTest('1y', 1000 * 60 * 60 * 24 * 365);
31
- addTest('1y 5', null);
32
- addTest('1m 1m', null);
33
- addTest('1m 1y', null);
34
- addTest('1y 1M 1w 1d 1h 1m 1s 1ms', 34822861001);
35
- addTest(' 5s 25ms ', 5025);
36
- });