Skip to content

Commit

Permalink
Merge pull request #2 from elkinaguas/add-tests
Browse files Browse the repository at this point in the history
Add tests
  • Loading branch information
elkinaguas authored Nov 11, 2023
2 parents 3616642 + ea8069a commit 880a20f
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 1 deletion.
22 changes: 21 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added tests/add_command.py
Empty file.
20 changes: 20 additions & 0 deletions tests/init_clir.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import os
import subprocess

subprocess.run(['clir', 'init'], capture_output=True, text=True)
dir_path = os.path.expanduser('~/.clir')
file_path = os.path.expanduser('~/.clir/commands.json')
command_file_creation_time = os.path.getctime(file_path)

# Test if the clir folder environment was created
def test_clir_project_folder_created():
assert os.path.exists(dir_path)

# Test if the commands.json file was created
def test_command_file_created():
assert os.path.exists(file_path)

# Test if init command doesn't recreate the commands.json file
def test_init_command_doesnt_recreate_commands_json():
subprocess.run(['clir', 'init'], capture_output=True, text=True)
assert os.path.getctime(file_path) == command_file_creation_time
Empty file added tests/list_command.py
Empty file.
Empty file added tests/remove_command.py
Empty file.
Empty file added tests/run_command.py
Empty file.

0 comments on commit 880a20f

Please sign in to comment.