Skip to content

Commit

Permalink
feat: Implementing a Testsuite (#28)
Browse files Browse the repository at this point in the history
* feat: started implementing universial testsuite

* GitHub Actions

* added test badge to README.md

* Apply suggestions from code review

---------

Co-authored-by: Jan Max Meyer <jmm@phorward.de>
  • Loading branch information
LeopoldWichtel and phorward authored Oct 19, 2023
1 parent 782c9f4 commit 8454a9a
Show file tree
Hide file tree
Showing 18 changed files with 1,556 additions and 190 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test

on:
push:
branches: [ testsuite ]
pull_request:
branches: [ main ]

jobs:
test_js:
name: test logics-js
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- run: cd logics-js && npm install --save-dev && npm test
test_py:
name: test logics-py
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install pipenv
run: pip install pipenv
- name: Run Testsuite
run: cd logics-py && pipenv install --dev && pipenv run pytest -vvv

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
*.pyc
.idea
.vscode
logics-py/dist
logics-py/.venv
logics-js/node_modules
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<a href="https://github.com/viur-framework/logics/LICENSE">
<img src="https://img.shields.io/github/license/viur-framework/logics" alt="Badge displaying the license" title="License badge">
</a>
<a href="https://github.com/LeopoldWichtel/logics/actions/workflows/test.yml">
<img src="https://github.com/LeopoldWichtel/logics/actions/workflows/test.yml/badge.svg" alt="Badge displaying the test status" title="Test badge">
</a>

<br>
A tiny, sandboxed, secure and extendable formula language with a flavor of Python.
</div>
Expand Down
2 changes: 1 addition & 1 deletion logics-js/logics.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
console.debug("values = ", values);

try {
calc = new Logics(e.target.value);
calc = new logics.Logics(e.target.value);

let result = calc.run(values);
console.debug("result = ", result);
Expand Down
8 changes: 6 additions & 2 deletions logics-js/logics.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,10 @@ export default class Logics {
}

// Register Logics in the browser
if (window !== undefined) {
window.Logics = Logics;
if (typeof window !== "undefined") {
window.logics = {
"Logics": Logics,
"Value": Value
};
}

Loading

0 comments on commit 8454a9a

Please sign in to comment.