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

Add tests for CLI mode #96

Merged
merged 9 commits into from
Nov 17, 2020
2 changes: 2 additions & 0 deletions .github/workflows/check-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
uses: actions/checkout@v2
- name: Setup node and npm
uses: actions/setup-node@v1
with:
node-version: 13.12.0
- name: install packages
run: npm install .
# Runs the Linter action
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
node-version: 13.12.0
- run: npm ci
- run: npm run test-on-github

Expand All @@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
node-version: 13.12.0
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
Expand Down
52 changes: 47 additions & 5 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
"test": "mocha --expose-gc --timeout 40000",
"start": "node ../server.js",
"lint": "eslint .",
"test-on-github": "mocha --expose-gc --timeout 40000 --ignore test/test_filesFromWild.js"
"test-on-github": "mocha --expose-gc --timeout 40000 --ignore test/test_filesFromWild.js --ignore test/test_cli.js"
},
"dependencies": {
"concat-stream": "^2.0.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a dev-dependency?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. It is used in testing. So we can move it to dev-dependencies. Shall change that

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, let's do that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

"jsonschema": "^1.4.0",
"ohm-js": "^15.2.1",
"yargs": "^16.0.3"
Expand Down
40 changes: 40 additions & 0 deletions test/resources/small.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"book": {
"bookCode": "GEN",
"description": "A small sample usfm file"
},
"chapters": [
{
"chapterNumber": "1",
"contents": [
{
"p": null
},
{
"verseNumber": "1",
"verseText": "one verse",
"contents": [
"one verse"
]
},
{
"verseNumber": "2",
"verseText": "second verse",
"contents": [
"second verse"
]
},
{
"verseNumber": "3",
"verseText": "final verse",
"contents": [
"final verse"
]
}
]
}
],
"_messages": {
"_warnings": []
}
}
6 changes: 6 additions & 0 deletions test/resources/small.usfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
\id GEN A small sample usfm file
\c 1
\p
\v 1 one verse
\v 2 second verse
\v 3 final verse
40 changes: 40 additions & 0 deletions test/resources/small1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"book": {
"bookCode": "GEN",
"description": "A small sample usfm file"
},
"chapters": [
{
"chapterNumber": "1",
"contents": [
{
"p": null
},
{
"verseNumber": "1",
"verseText": "one verse",
"contents": [
"one verse"
]
},
{
"verseNumber": "2",
"verseText": "second verse",
"contents": [
"second verse"
]
},
{
"verseNumber": "3",
"verseText": "final verse",
"contents": [
"final verse"
]
}
]
}
],
"_messages": {
"_warnings": []
}
}
40 changes: 40 additions & 0 deletions test/resources/small2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"book": {
"bookCode": "GEN",
"description": "A small sample usfm file"
},
"chapters": [
{
"chapterNumber": "1",
"contents": [
{
"p": null
},
{
"verseNumber": "1",
"verseText": "one verse",
"contents": [
"one verse"
]
},
{
"verseNumber": "2",
"verseText": "second verse",
"contents": [
"second verse"
]
},
{
"verseNumber": "3",
"verseText": "final verse",
"contents": [
"final verse"
]
}
]
}
],
"_messages": {
"_warnings": []
}
}
Loading