Skip to content

Commit

Permalink
refactor: helpers refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Mucha <[email protected]>
  • Loading branch information
drptbl committed Dec 11, 2020
1 parent b2cc826 commit 45cb4e4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions helpers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const axios = require('axios');
const fs = require('fs');
const unzip = require('unzipper');
const path = require('path');

module.exports = {
getSynpressPath: () => {
Expand Down Expand Up @@ -34,4 +35,16 @@ module.exports = {
stream.pipe(unzip.Extract({ path: destination }).on('close', resolve)),
);
},
prepareMetamask: async () => {
const release = await this.getMetamaskReleases();
const downloadsDirectory = path.resolve(__dirname, 'downloads');
if (!fs.existsSync(downloadsDirectory)) {
fs.mkdirSync(downloadsDirectory);
}
const downloadDestination = path.join(downloadsDirectory, release.filename);
await this.download(release.downloadUrl, downloadDestination);
const metamaskDirectory = path.join(downloadsDirectory, 'metamask');
await this.extract(downloadDestination, metamaskDirectory);
return metamaskDirectory;
},
};

0 comments on commit 45cb4e4

Please sign in to comment.