fix(core): update
This commit is contained in:
44
test/test.ts
44
test/test.ts
@ -1,9 +1,9 @@
|
||||
import { tap, expect } from '@pushrocks/tapbundle';
|
||||
import { tap, expect } from '@push.rocks/tapbundle';
|
||||
|
||||
import * as path from 'path';
|
||||
import * as smartpath from '@pushrocks/smartpath';
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartrequest from '@pushrocks/smartrequest';
|
||||
import * as smartpath from '@push.rocks/smartpath';
|
||||
import * as smartfile from '@push.rocks/smartfile';
|
||||
import * as smartrequest from '@push.rocks/smartrequest';
|
||||
|
||||
const testPlugins = {
|
||||
path,
|
||||
@ -12,8 +12,14 @@ const testPlugins = {
|
||||
};
|
||||
|
||||
const testPaths = {
|
||||
nogitDir: testPlugins.path.join(smartpath.get.dirnameFromImportMetaUrl(import.meta.url), '../.nogit/'),
|
||||
remoteDir: testPlugins.path.join(smartpath.get.dirnameFromImportMetaUrl(import.meta.url), '../.nogit/remote'),
|
||||
nogitDir: testPlugins.path.join(
|
||||
smartpath.get.dirnameFromImportMetaUrl(import.meta.url),
|
||||
'../.nogit/'
|
||||
),
|
||||
remoteDir: testPlugins.path.join(
|
||||
smartpath.get.dirnameFromImportMetaUrl(import.meta.url),
|
||||
'../.nogit/remote'
|
||||
),
|
||||
};
|
||||
|
||||
import * as smartarchive from '../ts/index.js';
|
||||
@ -25,7 +31,7 @@ tap.preTask('should prepare .nogit dir', async () => {
|
||||
tap.preTask('should prepare downloads', async (tools) => {
|
||||
const downloadedFile: Buffer = (
|
||||
await testPlugins.smartrequest.getBinary(
|
||||
'https://verdaccio.lossless.one/@pushrocks%2fwebsetup/-/websetup-2.0.14.tgz'
|
||||
'https://verdaccio.lossless.digital/@pushrocks%2fwebsetup/-/websetup-2.0.14.tgz'
|
||||
)
|
||||
).body;
|
||||
await testPlugins.smartfile.memory.toFs(
|
||||
@ -45,7 +51,7 @@ tap.test('should extract existing files on disk', async () => {
|
||||
tap.test('should download a package from the registry', async () => {
|
||||
const testSmartarchive = new smartarchive.SmartArchive();
|
||||
await testSmartarchive.extractArchiveFromUrlToFs(
|
||||
'https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-7.0.11.tgz',
|
||||
'https://verdaccio.lossless.digital/@pushrocks%2fsmartfile/-/smartfile-7.0.11.tgz',
|
||||
testPaths.remoteDir
|
||||
);
|
||||
});
|
||||
@ -79,17 +85,19 @@ tap.test('should extract a file from url to replaySubject', async (tools) => {
|
||||
const done = tools.defer();
|
||||
const testSmartarchive = new smartarchive.SmartArchive();
|
||||
const extractionFileObservable = await testSmartarchive.extractArchiveFromUrlToObservable(
|
||||
'https://verdaccio.lossless.one/@pushrocks%2fwebsetup/-/websetup-2.0.14.tgz'
|
||||
'https://verdaccio.lossless.digital/@pushrocks%2fwebsetup/-/websetup-2.0.14.tgz'
|
||||
);
|
||||
const subscription = extractionFileObservable.subscribe(
|
||||
(file) => {
|
||||
console.log(file.path);
|
||||
},
|
||||
(err) => {
|
||||
console.log(err);
|
||||
},
|
||||
() => {
|
||||
done.resolve();
|
||||
}
|
||||
);
|
||||
const subscription = extractionFileObservable.subscribe((file) => {
|
||||
console.log(file.path);
|
||||
},
|
||||
(err) => {
|
||||
console.log(err);
|
||||
},
|
||||
() => {
|
||||
done.resolve();
|
||||
});
|
||||
await done.promise;
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user