Skip to content

Commit

Permalink
feature: pack: get rid of mock-require
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Mar 22, 2024
1 parent 25d8fae commit 770a081
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/rest/pack.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
'use strict';

const mockRequire = require('mock-require');
const fs = require('node:fs');
const {join} = require('node:path');
const {promisify} = require('node:util');

const {reRequire} = require('mock-require');
const test = require('supertape');
const tar = require('tar-stream');
const gunzip = require('gunzip-maybe');
const pullout = require('pullout');

const cloudcmdPath = '../..';
const cloudcmd = require(cloudcmdPath);
const cloudcmd = require('../../server/cloudcmd.js');
const serveOnce = require('serve-once');

const {reRequire} = mockRequire;
const pathZipFixture = join(__dirname, '..', 'fixture/pack.zip');

const pathTarFixture = join(__dirname, '..', 'fixture/pack.tar.gz');
Expand All @@ -39,6 +38,7 @@ const once = promisify((name, extract, fn) => {
});

test('cloudcmd: rest: pack: tar: get', async (t) => {
debugger;
const config = {
packer: 'tar',
auth: false,
Expand All @@ -48,7 +48,6 @@ test('cloudcmd: rest: pack: tar: get', async (t) => {
config,
};

const cloudcmd = reRequire(cloudcmdPath);
const {request} = serveOnce(cloudcmd, defaultOptions);

const {body} = await request.get(`/api/v1/pack/fixture/pack`, {
Expand All @@ -68,7 +67,7 @@ test('cloudcmd: rest: pack: tar: get', async (t) => {

t.equal(file, data, 'should pack data');
t.end();
});
}, {timeout: 7000});

test('cloudcmd: rest: pack: tar: put: file', async (t) => {
const config = {
Expand Down Expand Up @@ -234,3 +233,4 @@ function getPackOptions(to, names = ['pack']) {
from: '/fixture',
};
}

0 comments on commit 770a081

Please sign in to comment.