Skip to content

Commit

Permalink
Merge pull request #1 from openaddresses/tests
Browse files Browse the repository at this point in the history
Add Tests
  • Loading branch information
ingalls authored Sep 4, 2024
2 parents 177c489 + 0c10a65 commit ec3fcaa
Show file tree
Hide file tree
Showing 13 changed files with 968 additions and 1,578 deletions.
3 changes: 0 additions & 3 deletions .copyeditorrc

This file was deleted.

54 changes: 0 additions & 54 deletions .eslintrc.json

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test

on:
push:
branches:
- master
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review

jobs:
test:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.sha || github.sha}}

- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org/

- name: Install
run: npm install

- name: Lint
run: npm run lint

- name: Test
run: npm test
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
venv
venv
node_modules/
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

3 changes: 1 addition & 2 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

ISC License

Copyright (c) 2017, Mapbox
Copyright (c) 2017, Mapbox, 2024 Nick Ingalls

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
Expand Down
File renamed without changes.
38 changes: 38 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import js from "@eslint/js";
import nodePlugin from "eslint-plugin-n";

export default [
js.configs.recommended,
nodePlugin.configs["flat/recommended-module"],
{
"rules": {
"no-console": 0,
"arrow-parens": [ "error", "always" ],
"no-var": "error",
"prefer-const": "error",
"array-bracket-spacing": [ "error", "never" ],
"comma-dangle": [ "error", "never" ],
"computed-property-spacing": [ "error", "never" ],
"eol-last": "error",
"eqeqeq": [ "error", "smart" ],
"indent": [ "error", 4, { "SwitchCase": 1 } ],
"no-confusing-arrow": [ "error", { "allowParens": false } ],
"no-extend-native": "error",
"no-mixed-spaces-and-tabs": "error",
"func-call-spacing": [ "error", "never" ],
"no-trailing-spaces": "error",
"no-unused-vars": "error",
"no-use-before-define": [ "error", "nofunc" ],
"object-curly-spacing": [ "error", "always" ],
"prefer-arrow-callback": "error",
"quotes": [ "error", "single", "avoid-escape" ],
"semi": [ "error", "always" ],
"space-infix-ops": "error",
"spaced-comment": [ "error", "always" ],
"keyword-spacing": [ "error", { "before": true, "after": true } ],
"template-curly-spacing": [ "error", "never" ],
"semi-spacing": "error",
"strict": "error",
}
}
]
28 changes: 21 additions & 7 deletions lib/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export default function() {
if (arg.Metadata) Object.keys(arg.Metadata).forEach((key) => {
if (names.Metadata.has(key)) {
try { assert.deepEqual(template.Metadata[key], arg.Metadata[key]); }
catch (err) { throw new Error('Metadata name used more than once: ' + key); }
catch (err) { throw new Error('Metadata name used more than once: ' + key, {
cause: err
}); }
}

template.Metadata[key] = arg.Metadata[key];
Expand All @@ -60,7 +62,9 @@ export default function() {
if (arg.Parameters) Object.keys(arg.Parameters).forEach((key) => {
if (names.Parameters.has(key)) {
try { assert.deepEqual(template.Parameters[key], arg.Parameters[key]); }
catch (err) { throw new Error('Parameters name used more than once: ' + key); }
catch (err) { throw new Error('Parameters name used more than once: ' + key, {
cause: err
}); }
}

template.Parameters[key] = arg.Parameters[key];
Expand All @@ -70,7 +74,9 @@ export default function() {
if (arg.Rules) Object.keys(arg.Rules).forEach((key) => {
if (names.Rules.has(key)) {
try { assert.deepEqual(template.Rules[key], arg.Rules[key]); }
catch (err) { throw new Error('Rules name used more than once: ' + key); }
catch (err) { throw new Error('Rules name used more than once: ' + key, {
cause: err
}); }
}

template.Rules[key] = arg.Rules[key];
Expand All @@ -80,7 +86,9 @@ export default function() {
if (arg.Mappings) Object.keys(arg.Mappings).forEach((key) => {
if (names.Mappings.has(key)) {
try { assert.deepEqual(template.Mappings[key], arg.Mappings[key]); }
catch (err) { throw new Error('Mappings name used more than once: ' + key); }
catch (err) { throw new Error('Mappings name used more than once: ' + key, {
cause: err
}); }
}

template.Mappings[key] = arg.Mappings[key];
Expand All @@ -90,7 +98,9 @@ export default function() {
if (arg.Conditions) Object.keys(arg.Conditions).forEach((key) => {
if (names.Conditions.has(key)) {
try { assert.deepEqual(template.Conditions[key], arg.Conditions[key]); }
catch (err) { throw new Error('Conditions name used more than once: ' + key); }
catch (err) { throw new Error('Conditions name used more than once: ' + key, {
cause: err
}); }
}

template.Conditions[key] = arg.Conditions[key];
Expand All @@ -100,7 +110,9 @@ export default function() {
if (arg.Resources) Object.keys(arg.Resources).forEach((key) => {
if (names.Resources.has(key)) {
try { assert.deepEqual(template.Resources[key], arg.Resources[key]); }
catch (err) { throw new Error('Resources name used more than once: ' + key); }
catch (err) { throw new Error('Resources name used more than once: ' + key, {
cause: err
}); }
}

template.Resources[key] = arg.Resources[key];
Expand All @@ -110,7 +122,9 @@ export default function() {
if (arg.Outputs) Object.keys(arg.Outputs).forEach((key) => {
if (names.Outputs.has(key)) {
try { assert.deepEqual(template.Outputs[key], arg.Outputs[key]); }
catch (err) { throw new Error('Outputs name used more than once: ' + key); }
catch (err) { throw new Error('Outputs name used more than once: ' + key, {
cause: err
}); }
}

template.Outputs[key] = arg.Outputs[key];
Expand Down
26 changes: 0 additions & 26 deletions local.dic

This file was deleted.

Loading

0 comments on commit ec3fcaa

Please sign in to comment.