0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-30 22:34:10 -05:00

chore(api): fix void return for some tests (#4969)

This commit is contained in:
Marc Bernard 2024-11-29 18:23:47 -05:00 committed by GitHub
parent 64a7fc0fc7
commit 6e344d0f48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 5 deletions

View file

@ -0,0 +1,5 @@
---
'@verdaccio/api': patch
---
chore(api): fix void return for some tests

View file

@ -31,12 +31,13 @@ describe('package', () => {
['@scope/foo2', 'foo2-1.0.0.tgz'], ['@scope/foo2', 'foo2-1.0.0.tgz'],
])('should fails if tarball does not exist', async (pkg, fileName) => { ])('should fails if tarball does not exist', async (pkg, fileName) => {
await publishVersion(app, pkg, '1.0.1'); await publishVersion(app, pkg, '1.0.1');
return await supertest(app) await supertest(app)
.get(`/${pkg}/-/${fileName}`) .get(`/${pkg}/-/${fileName}`)
.set(HEADERS.ACCEPT, HEADERS.JSON) .set(HEADERS.ACCEPT, HEADERS.JSON)
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.OCTET_STREAM) .expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.OCTET_STREAM)
.expect(HTTP_STATUS.NOT_FOUND); .expect(HTTP_STATUS.NOT_FOUND);
}); });
test.todo('check content length file header'); test.todo('check content length file header');
test.todo('fails on file was aborted'); test.todo('fails on file was aborted');
}); });

View file

@ -57,7 +57,7 @@ describe('publish', () => {
async (pkgName) => { async (pkgName) => {
const app = await initializeServer('publish.yaml'); const app = await initializeServer('publish.yaml');
await publishVersion(app, pkgName, '1.0.0'); await publishVersion(app, pkgName, '1.0.0');
return new Promise((resolve) => { new Promise((resolve) => {
publishVersion(app, pkgName, '1.0.0') publishVersion(app, pkgName, '1.0.0')
.expect(HTTP_STATUS.CONFLICT) .expect(HTTP_STATUS.CONFLICT)
.then((response) => { .then((response) => {
@ -73,7 +73,7 @@ describe('publish', () => {
describe('no proxies setup', () => { describe('no proxies setup', () => {
test.each([['foo', '@scope/foo']])('should publish a package', async (pkgName) => { test.each([['foo', '@scope/foo']])('should publish a package', async (pkgName) => {
const app = await initializeServer('publish.yaml'); const app = await initializeServer('publish.yaml');
return new Promise((resolve) => { new Promise((resolve) => {
publishVersion(app, pkgName, '1.0.0') publishVersion(app, pkgName, '1.0.0')
.expect(HTTP_STATUS.CREATED) .expect(HTTP_STATUS.CREATED)
.then((response) => { .then((response) => {
@ -86,7 +86,7 @@ describe('publish', () => {
test.each([['foo', '@scope/foo']])('should publish a new package', async (pkgName) => { test.each([['foo', '@scope/foo']])('should publish a new package', async (pkgName) => {
const pkgMetadata = generatePackageMetadata(pkgName, '1.0.0'); const pkgMetadata = generatePackageMetadata(pkgName, '1.0.0');
const app = await initializeServer('publish.yaml'); const app = await initializeServer('publish.yaml');
return new Promise((resolve) => { new Promise((resolve) => {
supertest(app) supertest(app)
.put(`/${encodeURIComponent(pkgName)}`) .put(`/${encodeURIComponent(pkgName)}`)
.set(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON) .set(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON)

View file

@ -65,7 +65,7 @@ describe('star', () => {
const app = await initializeServer('star.yaml'); const app = await initializeServer('star.yaml');
const token = await getNewToken(app, { name: userLogged, password: 'secretPass' }); const token = await getNewToken(app, { name: userLogged, password: 'secretPass' });
await publishVersion(app, pkgName, '1.0.0', undefined, token).expect(HTTP_STATUS.CREATED); await publishVersion(app, pkgName, '1.0.0', undefined, token).expect(HTTP_STATUS.CREATED);
return supertest(app) await supertest(app)
.get(`/-/_view/starredByUser?key_xxxxx=other`) .get(`/-/_view/starredByUser?key_xxxxx=other`)
.set('Accept', HEADERS.JSON) .set('Accept', HEADERS.JSON)
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET) .expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)