0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-04-01 02:42:23 -05:00

fix: memory plugin limit error message (#5147)

This commit is contained in:
Marc Bernard 2025-03-17 19:36:45 +01:00 committed by GitHub
parent 99f6e118e2
commit 648aaf93bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View file

@ -0,0 +1,5 @@
---
'verdaccio-memory': patch
---
fix: memory plugin limit error message

View file

@ -15,6 +15,7 @@ export interface MemoryLocalStorage {
const debug = buildDebug('verdaccio:plugin:storage:local-memory');
const DEFAULT_LIMIT = 1000;
class LocalMemory
extends pluginUtils.Plugin<ConfigMemory>
implements pluginUtils.Storage<ConfigMemory>
@ -65,7 +66,7 @@ class LocalMemory
{ limit: this.limit },
'Storage memory has reached limit of @{limit} packages'
);
reject(new Error('Storage memory has reached limit of limit packages'));
reject(new Error(`Storage memory has reached limit of ${this.limit} packages`));
}
});
}

View file

@ -7,7 +7,6 @@ import { logger, setup } from '@verdaccio/logger';
import LocalMemory from '../src/index';
import { ConfigMemory } from '../src/local-memory';
import { DataHandler } from '../src/memory-handler';
setup({});
@ -33,7 +32,7 @@ describe('memory unit test .', () => {
{ ...defaultConfig, config }
);
localMemory.add('test').then(() => {
localMemory.get().then((data: DataHandler) => {
localMemory.get().then((data) => {
expect(data).toHaveLength(1);
done(true);
});
@ -52,7 +51,7 @@ describe('memory unit test .', () => {
localMemory.add('test2').then(() => {
localMemory.add('test3').catch((err) => {
expect(err).not.toBeNull();
expect(err.message).toMatch(/Storage memory has reached limit of limit packages/);
expect(err.message).toMatch(/Storage memory has reached limit of 2 packages/);
done(true);
});
});