Skip to content

Commit

Permalink
Added tests and workflow barch to readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
castmart committed Dec 12, 2023
1 parent 88c2a67 commit feae030
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push]
jobs:
Explore-GitHub-Actions:
Run-Library-Tests:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
Expand All @@ -12,7 +12,7 @@ jobs:
uses: actions/checkout@v4
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
- name: Execute tests
run: |
ls ${{ github.workspace }}
make test
- run: echo "🍏 This job's status is ${{ job.status }}."
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ publish-to-ossrh:
GPG_SIGNING_KEY=${GPG_SIGNING_KEY} \
JCOUNTRY_VERSION=${version} \
./gradlew publish

.PHONY: test
test:
./gradlew test
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![CI](https://github.com/castmart/jcountry/actions/workflows/ci.yaml/badge.svg)](https://github.com/castmart/jcountry/actions/workflows/ci.yaml)

# JCountry

This project tries to replicate the same functionality as [pycountry](https://github.com/flyingcircusio/pycountry) by wrapping iso files and provide a programatic interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ void testJCountryReadsTranslations() {

languages.forEach( it -> {
Optional<ResourceBundle> bundle = countryDB.getCountriesTranslations(new Locale(it));
if (bundle.isEmpty())
System.out.println("Empty bundle for "+it);
else
System.out.println("Processing "+it);
assertTrue(!bundle.isEmpty());
});
}
Expand Down Expand Up @@ -114,13 +118,18 @@ void testJCountryLanguagesReadsTranslations() {

languages.forEach( it -> {
Optional<ResourceBundle> bundle = languageDB.getLanguagesTranslations(new Locale(it));
if (bundle.isEmpty())
System.out.println("Empty bundle for "+it);
else
System.out.println("Processing "+it);
assertTrue(!bundle.isEmpty(), it + " translation");
});
}

@Test
void getTranslatedLanguageName() {
LanguageDB languageDB = new LanguageDBImpl(true);
JCountry.getInstance().getLanguageDB();
var dbByAlpha2 = languageDB.getLanguagesMapByAlpha2();

Optional<ResourceBundle> bundle = languageDB.getLanguagesTranslations(Locale.GERMAN);
Expand Down

0 comments on commit feae030

Please sign in to comment.