1
0
mirror of https://github.com/garraflavatra/alphabets.git synced 2025-01-18 21:27:58 +00:00

Add code testing

This commit is contained in:
Romein van Buren 2021-05-24 13:39:07 +02:00
parent 68c66bdb4f
commit 06fee1f969
5 changed files with 12583 additions and 4 deletions

30
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,30 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 15.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test

12522
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,13 +5,15 @@
"main": "dist/bundle.js",
"scripts": {
"build": "rollup -c",
"prepare": "husky install"
"prepare": "husky install",
"test": "jest"
},
"keywords": [],
"author": "Romein van Buren <romein@vburen.eu>",
"license": "MIT",
"devDependencies": {
"husky": "^6.0.0",
"jest": "^26.6.3",
"rollup": "^2.49.0",
"rollup-plugin-clear": "^2.0.7",
"rollup-plugin-terser": "^7.0.2"

25
src/bundle.test.js Normal file
View File

@ -0,0 +1,25 @@
const alphabets = require("../dist/bundle.js");
const latin = [
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
];
const greek = [
"α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "σ", "τ", "υ", "φ", "χ", "ψ", "ω"
];
const greekPolytonic = [
"α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "σ", "τ", "υ", "φ", "χ", "ψ", "ω"
];
test('alphabets.latin should return Latin alphabet', () => {
expect(alphabets.latin).toStrictEqual(latin);
});
test('alphabets.greek should return Greek alphabet', () => {
expect(alphabets.greek).toStrictEqual(greek);
});
test('alphabets.greekPolytonic should return Greek (Polytonic) alphabet', () => {
expect(alphabets.greekPolytonic).toStrictEqual(greekPolytonic);
});

View File

@ -4,11 +4,11 @@ export const latin = [
export const greek = [
"α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "σ", "τ", "υ", "φ", "χ", "ψ", "ω"
]
];
export const greekPolytonic = [
"α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "σ", "τ", "υ", "φ", "χ", "ψ", "ω"
]
];
export default [
latin,