-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from opencollective/dev/add-tests-and-ci
Add tests + prettier and configure CI
- Loading branch information
Showing
9 changed files
with
3,731 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
|
||
jobs: | ||
prettier: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
cache: "npm" | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Prettier | ||
run: npm run prettier:check | ||
|
||
test: | ||
name: Unit tests | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [16.x, 18.x, 20.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: "npm" | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Run tests | ||
run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -250,4 +250,3 @@ | |
"ZM": "🇿🇲", | ||
"ZW": "🇿🇼" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const { getEmojiByCountryCode } = require("./index"); | ||
const { getEmojiByCurrencyCode } = require("./index"); | ||
|
||
describe("getEmojiByCountryCode", () => { | ||
it("should return null if no country code is passed", () => { | ||
expect(getEmojiByCountryCode()).toBeNull(); | ||
}); | ||
|
||
it("should return the emoji for the country code passed", () => { | ||
expect(getEmojiByCountryCode("us")).toBe("🇺🇸"); | ||
expect(getEmojiByCountryCode("US")).toBe("🇺🇸"); | ||
expect(getEmojiByCountryCode("FR")).toBe("🇫🇷"); | ||
}); | ||
}); | ||
|
||
describe("getEmojiByCurrencyCode", () => { | ||
it("should return null if no currency code is passed", () => { | ||
expect(getEmojiByCurrencyCode()).toBeNull(); | ||
}); | ||
|
||
it("should return the emoji for the currency code passed", () => { | ||
expect(getEmojiByCurrencyCode("usd")).toBe("🇺🇸"); | ||
expect(getEmojiByCurrencyCode("EUR")).toBe("🇪🇺"); | ||
expect(getEmojiByCurrencyCode("GBP")).toBe("🇬🇧"); | ||
}); | ||
}); |
Oops, something went wrong.