Skip to content

Commit

Permalink
add test cases for InstaPy setup checking if InstaPy files exist
Browse files Browse the repository at this point in the history
  • Loading branch information
converge committed Apr 15, 2019
1 parent 47e3adb commit 74bde8a
Show file tree
Hide file tree
Showing 3 changed files with 6,415 additions and 3,509 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

## MacOS Install

### 1. Install Project Dependencies:
Expand Down Expand Up @@ -47,6 +46,7 @@ npm install
**Official documentation from** https://www.npmjs.com/package/npm

#### Super Easy Install

npm is bundled with node.

[Get the MSI](https://nodejs.org/en/download/). npm is in it.
Expand All @@ -61,11 +61,11 @@ npm install

## Project Setup

Create a ```.env``` on root folder of the project with this content:
Create a `.env` file on root folder of the project with following content:

```js
# MacOS: /Users/your_user_name/InstaPy
# you can also check this information when running your quickstart.py,
# you can also check this information when running your quickstart.py,
# the first lines contains
# -> Workspace in use: "/Users/converge/InstaPy"
INSTAPY_FOLDER=/Users/converge/InstaPy
Expand All @@ -80,7 +80,15 @@ NODE_PORT=3001
PORT=3000
```

Windows user ? Don't add ```c:``` in the ```InstaPyFolder```, it should be ```\path\to\InstaPy``` without the ```c:```
Windows user ? Don't add `c:` in the `InstaPyFolder`, it should be `\path\to\InstaPy` without the `c:`

## Check if everything is ok

Create a `.env.test` file on root folder with same content of `.env` and run:

```bash
npm run test
```

## Start the project

Expand Down
16 changes: 16 additions & 0 deletions __tests__/integration/setup.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require('dotenv').config({
path: process.env.NODE_ENV === 'test' ? '.env.test' : '.env'
})
const fs = require('fs')

describe('Check if .env is setup corretly', () => {
it('should locate InstaPy database', () => {
dbFile = `${process.env.INSTAPY_FOLDER}/db/instapy.db`
expect(fs.existsSync(dbFile)).toBeTruthy()
})

it('should locate InstaPy log folder', () => {
logsFolder = `${process.env.INSTAPY_FOLDER}/logs/`
expect(fs.existsSync(logsFolder)).toBeTruthy()
})
})
Loading

0 comments on commit 74bde8a

Please sign in to comment.