Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: gif and unit test #59

Merged
merged 4 commits into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Unleash the power of env0 directly from your Visual Studio Code workspace! The env0 extension allows seamless interaction with your env0 environments, making your development process smoother and more efficient.

![Demo](assets/demo.gif)

## 🌟 Features

### View Environments
Expand Down Expand Up @@ -31,7 +33,7 @@ Before using this extension, make sure you meet the following prerequisites:
To login or logout, simply use the `env0.login` and `env0.logout` commands through the VS Code command palette (Command / Ctrl + Shift + P).

## 🌳 Environments View

![Demo](assets/demo2.gif)
**Focused Environments View**: The environments view is designed to show you only the environments that are specifically associated with the current branch you're working on, keeping your workflow clean and focused.

## 🚧 Limitations
Expand Down Expand Up @@ -90,7 +92,35 @@ The VS Code API presents some unique challenges, such as not being able to read
Moreover, we import the compiled dist extension file into our test setup. This enables us to run specific functions that are part of the extension, such as resetting its state after each test or ensuring that the Tree View displays the appropriate messages.

### Unit Testing
(WIP)

#### Running the Tests

To run the integration tests, execute the following command in your terminal:

```bash
pnpm run unit:test
```

#### Libraries Used

- [**Mocha**](https://www.npmjs.com/package/mocha): This is utilized as the test runner.
- [**Expect**](https://www.npmjs.com/package/expect): This library is used for assertions.
- [**Jest-Mock**](https://www.npmjs.com/package/jest-mock): Employed for mocking, stubbing, and spying on functions.
- [**mock-require**](https://www.npmjs.com/package/mock-require): Used specifically for mocking Visual Studio Code (VSCode).

#### Testing Objectives

Our unit tests are designed to verify the following functionalities:
- Ensuring that user credentials are correctly saved in the VSCode secrets store upon login.
- Confirming that these credentials are deleted when the user logs out.

#### Important Note on Imports

When working with the tests, it is imperative to import the `mocks/vscode` file before importing the file under test. This is because we mock the VSCode import within the `mocks/vscode` file.

#### Test Files

The unit tests are executed on the source TypeScript files, not on the compiled files. We have integrated `ts-node` with Mocha to facilitate the compilation of files during testing.

### 📚 Recommended Reading

Expand Down
Binary file added assets/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/demo2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.