Skip to content

Commit

Permalink
Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ozziest committed Dec 21, 2023
1 parent a044e8c commit 701a650
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ jobs:
- run: npm run build
- run: npm run test

cjs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: |
npm ci
npm run build
cd node-tester/cjs
npm install
node index.js
linting:
runs-on: ubuntu-latest
strategy:
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_modules
dist
coverage
node-tester
coverage
27 changes: 27 additions & 0 deletions node-tester/cjs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const { validate, setLocales } = require("axe-api-validator");
const en = require("axe-api-validator/dist/i18n/en.json");

const data = {
email: null,
};

const rules = {
email: "required|email|min:1|max:50",
};

const main = async () => {
setLocales(en);
const result = await validate(data, rules);
if (result.isValid) {
throw new Error("The email should be invalid!");
}

const { message } = result.errors.email[0];
if (message !== "The field field is required.") {
throw new Error(`Unaccepted message: ${message}`);
}

console.log("Success!");
};

main();
93 changes: 93 additions & 0 deletions node-tester/cjs/package-lock.json

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

16 changes: 16 additions & 0 deletions node-tester/cjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "tester",
"version": "1.0.0",
"description": "",
"main": "common.js",
"type": "commonjs",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"axe-api-validator": "file:../../"
}
}
Empty file added node-tester/esm/.gitkeep
Empty file.

0 comments on commit 701a650

Please sign in to comment.