-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
3,521 additions
and
0 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,15 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
insert_final_newline = false | ||
trim_trailing_whitespace = false | ||
|
||
[*.{js,json,ts,mts,yml,yaml}] | ||
indent_size = 2 | ||
indent_style = space |
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 @@ | ||
/**/*.js |
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,27 @@ | ||
{ | ||
"env": { | ||
"browser": false, | ||
"es6": true, | ||
"node": true | ||
}, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "tsconfig.json", | ||
"sourceType": "module", | ||
"ecmaVersion": 2020 | ||
}, | ||
"plugins": ["@typescript-eslint", "jest"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:jest/recommended", | ||
"prettier" | ||
], | ||
"rules": { | ||
// The following rule is enabled only to supplement the inline suppression | ||
// examples, and because it is not a recommended rule, you should either | ||
// disable it, or understand what it enforces. | ||
// https://typescript-eslint.io/rules/explicit-function-return-type/ | ||
"@typescript-eslint/explicit-function-return-type": "warn" | ||
} | ||
} |
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,12 @@ | ||
# These are supported funding model platforms | ||
|
||
github: [jsynowiec] | ||
patreon: # Replace with a single Patreon username | ||
open_collective: # Replace with a single Open Collective username | ||
ko_fi: # Replace with a single Ko-fi username | ||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
liberapay: # Replace with a single Liberapay username | ||
issuehunt: # Replace with a single IssueHunt username | ||
otechie: # Replace with a single Otechie username | ||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] |
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,17 @@ | ||
name: Node.js CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: volta-cli/action@v1 | ||
- run: npm ci --no-audit | ||
- run: npm run lint --if-present | ||
- run: npm test | ||
- run: npm run build --if-present | ||
env: | ||
CI: true |
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,12 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.mts"], | ||
"options": { | ||
"parser": "typescript" | ||
} | ||
} | ||
] | ||
} |
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,42 @@ | ||
import { Delays, greeter } from '../src/main.js'; | ||
|
||
describe('greeter function', () => { | ||
const name = 'John'; | ||
let hello: string; | ||
|
||
let timeoutSpy: jest.SpyInstance; | ||
|
||
// Act before assertions | ||
beforeAll(async () => { | ||
// Read more about fake timers | ||
// http://facebook.github.io/jest/docs/en/timer-mocks.html#content | ||
// Jest 27 now uses "modern" implementation of fake timers | ||
// https://jestjs.io/blog/2021/05/25/jest-27#flipping-defaults | ||
// https://github.com/facebook/jest/pull/5171 | ||
jest.useFakeTimers(); | ||
timeoutSpy = jest.spyOn(global, 'setTimeout'); | ||
|
||
const p: Promise<string> = greeter(name); | ||
jest.runOnlyPendingTimers(); | ||
hello = await p; | ||
}); | ||
|
||
// Teardown (cleanup) after assertions | ||
afterAll(() => { | ||
timeoutSpy.mockRestore(); | ||
}); | ||
|
||
// Assert if setTimeout was called properly | ||
it('delays the greeting by 2 seconds', () => { | ||
expect(setTimeout).toHaveBeenCalledTimes(1); | ||
expect(setTimeout).toHaveBeenLastCalledWith( | ||
expect.any(Function), | ||
Delays.Long, | ||
); | ||
}); | ||
|
||
// Assert greeter result | ||
it('greets a user with `Hello, {name}` message', () => { | ||
expect(hello).toBe(`Hello, ${name}`); | ||
}); | ||
}); |
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,18 @@ | ||
export default { | ||
testEnvironment: 'node', | ||
preset: 'ts-jest/presets/default-esm', | ||
transform: { | ||
'^.+\\.m?[tj]s?$': ['ts-jest', { useESM: true }], | ||
}, | ||
moduleNameMapper: { | ||
'^(\\.{1,2}/.*)\\.(m)?js$': '$1', | ||
}, | ||
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(m)?ts$', | ||
coverageDirectory: 'coverage', | ||
collectCoverageFrom: [ | ||
'src/**/*.ts', | ||
'src/**/*.mts', | ||
'!src/**/*.d.ts', | ||
'!src/**/*.d.mts', | ||
], | ||
}; |
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,44 @@ | ||
{ | ||
"name": "wallet-watch-bot", | ||
"version": "0.1.0", | ||
"description": "Sends a message to the discord channel when a transaction occurs for a specified Ethereum address", | ||
"type": "module", | ||
"engines": { | ||
"node": ">= 18.12 <19" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "~29.5", | ||
"@types/node": "~18", | ||
"@typescript-eslint/eslint-plugin": "~6.2", | ||
"@typescript-eslint/parser": "~6.2", | ||
"eslint": "~8.46", | ||
"eslint-config-prettier": "~9.0", | ||
"eslint-plugin-jest": "~27.2", | ||
"jest": "~29.6", | ||
"prettier": "~3.0", | ||
"rimraf": "~5.0", | ||
"ts-api-utils": "~1.0", | ||
"ts-jest": "~29.1", | ||
"typescript": "~5.1" | ||
}, | ||
"scripts": { | ||
"start": "node build/src/main.js", | ||
"clean": "rimraf coverage build tmp", | ||
"prebuild": "npm run lint", | ||
"build": "tsc -p tsconfig.json", | ||
"build:watch": "tsc -w -p tsconfig.json", | ||
"build:release": "npm run clean && tsc -p tsconfig.release.json", | ||
"lint": "eslint . --ext .ts --ext .mts", | ||
"test": "jest --coverage", | ||
"prettier": "prettier --config .prettierrc --write .", | ||
"test:watch": "jest --watch" | ||
}, | ||
"author": "Jakub Synowiec <jsynowiec@users.noreply.github.com>", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"tslib": "~2.6" | ||
}, | ||
"volta": { | ||
"node": "18.12.1" | ||
} | ||
} |
Oops, something went wrong.