Skip to content

Commit

Permalink
fix: minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
zluuba committed Aug 9, 2023
1 parent f390d58 commit 76d76b7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion __tests__/core.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const getFixturePath = (filename) => path.join(__dirname, '..', '__fixtures__', filename);
const tmpDir = path.join(os.tmpdir());
const tmpDir = os.tmpdir();

let htmlAfter;
let htmlBefore;
Expand Down Expand Up @@ -56,6 +56,11 @@ test('downloadPage main', async () => {

await downloadPage('https://ru.hexlet.io/courses', tmpDir);

console.log('-------------------------');
console.log(tmpDir);
console.log(await fsp.realpath(tmpDir));
console.log('-------------------------');

const expectedPng = await fsp.readFile(path.join(tmpDir, resources.dir, resources.png), 'utf-8');
const expectedCss = await fsp.readFile(path.join(tmpDir, resources.dir, resources.css), 'utf-8');
const expectedJs = await fsp.readFile(path.join(tmpDir, resources.dir, resources.js), 'utf-8');
Expand Down
2 changes: 1 addition & 1 deletion bin/pageLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ program
downloadPage(url, options.output)
.then((pageName) => console.log(pageName))
.catch((error) => {
console.log(`Oops. ${error}`);
console.error(`Oops. ${error}`);
process.exit(1);
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
getPageName,
} from './common.js';

const downloadPage = (rawLink, outPath) => {
const downloadPage = (rawLink, outPath = process.cwd()) => {
fsp.access(outPath)
.catch(() => fsp.mkdir(outPath, { recursive: true }));

Expand Down

0 comments on commit 76d76b7

Please sign in to comment.