Skip to content

Commit

Permalink
Add in eslint and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarah Hamilton authored and agwhi committed May 14, 2021
1 parent 5f7e1d4 commit 671744d
Show file tree
Hide file tree
Showing 7 changed files with 1,145 additions and 19 deletions.
26 changes: 26 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
env: {
node: true,
es6: true,
},
extends: ["airbnb-base", "prettier"],
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly",
},
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
},
plugins: ["prettier"],
rules: {
"prettier/prettier": "error",
quotes: ["error", "double"],
"no-console": "off",
"no-plusplus": "off",
"no-param-reassign": "off",
"no-new": "off",
"import/named": "off",
"import/no-cycle": "off",
},
};
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
./node_modules
node_modules
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ yarn add -D sls-test-tools

## Maintenance

sls-dev-tools is currently being actively maintained. If you find a problem with the tool, let us know and we'll solve it as quickly as possible.
sls-test-tools is currently being actively maintained. If you find a problem with the tool, let us know and we'll solve it as quickly as possible.
## Usage

- Copy the `test-lib.js` file, along with the `package.json` to your project.
Expand Down
15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
{
"name": "sls-test-tools",
"version": "1.0.0",
"scripts": {},
"scripts": {
"lint": "eslint ./src",
"fix": "yarn lint --fix"
},
"dependencies": {
"aws-sdk": "^2.711.0"
"aws-sdk": "^2.711.0",
"import-all.macro": "^3.1.0"
},
"devDependencies": {
"import-all.macro": "^3.1.0"
"eslint": "^7.25.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.4.0",
"prettier": "^2.2.1"
}
}
4 changes: 2 additions & 2 deletions src/assertions/toHaveSentEventBridgeMessage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ export default {
toHaveSentEventBridgeMessage(sqsResult) {
if (sqsResult.Messages) {
return {
message: () => `expected to have message in EventBridge Bus`,
message: () => "expected to have message in EventBridge Bus",
pass: true,
};
}
return {
message: () => `no message intercepted from EventBridge Bus`,
message: () => "no message intercepted from EventBridge Bus",
pass: false,
};
},
Expand Down
13 changes: 6 additions & 7 deletions src/assertions/toHaveSentEventWithSourceEqualTo/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
export default {
toHaveSentEventWithSourceEqualTo(sqsResult, expectedSourceName) {
const receivedSource = JSON.parse(sqsResult.Messages[0].Body).source;
if (receivedSource == expectedSourceName) {
if (receivedSource === expectedSourceName) {
return {
message: () =>
`expected sent event to have source ${expectedSourceName}`,
pass: true,
};
} else {
return {
message: () =>
`sent event source "${receivedSource}" does not match expected source "${expectedSourceName}"`,
pass: false,
};
}
return {
message: () =>
`sent event source "${receivedSource}" does not match expected source "${expectedSourceName}"`,
pass: false,
};
},
};
Loading

0 comments on commit 671744d

Please sign in to comment.