Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Commit 7e3e6d0

Browse files
authored
Merge pull request #203 from streamr-dev/dataunion-linting
DataUnion Linting
2 parents 78449c1 + 2dad5d9 commit 7e3e6d0

File tree

7 files changed

+123
-81
lines changed

7 files changed

+123
-81
lines changed

.github/workflows/nodejs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ jobs:
4848
run: npm ci
4949
- name: npm run eslint
5050
run: npm run eslint
51+
- name: test-types
52+
run: npm run test-types
5153

5254
test:
5355
name: Test Unit using Node ${{ matrix.node-version }}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"eslint": "eslint --cache-location=node_modules/.cache/.eslintcache/ '*/**/*.{js,ts}'",
2828
"test": "jest --detectOpenHandles",
2929
"test-unit": "jest test/unit --detectOpenHandles",
30+
"test-types": "tsc --noEmit --project ./tsconfig.test.json",
3031
"coverage": "jest --coverage",
3132
"test-integration": "jest --forceExit test/integration",
3233
"test-integration-no-resend": "jest --forceExit --testTimeout=10000 --testPathIgnorePatterns='resend|Resend' --testNamePattern='^((?!(resend|Resend|resent|Resent|gap|Gap)).)*$' test/integration/*.test.js",

src/rest/DataUnionEndpoints.ts

Lines changed: 105 additions & 72 deletions
Large diffs are not rendered by default.

test/integration/dataunion/DataUnionEndpoints.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ describe('DataUnionEndPoints', () => {
2626
const tokenMainnet = new Contract(config.clientOptions.tokenAddress, Token.abi, tokenAdminWallet)
2727

2828
afterAll(async () => {
29-
await providerMainnet.removeAllListeners()
30-
await providerSidechain.removeAllListeners()
29+
providerMainnet.removeAllListeners()
30+
providerSidechain.removeAllListeners()
3131
await adminClient.ensureDisconnected()
3232
})
3333

34-
const streamrClientCleanupList = []
34+
const streamrClientCleanupList: StreamrClient[] = []
3535
afterAll(async () => Promise.all(streamrClientCleanupList.map((c) => c.ensureDisconnected())))
3636

3737
beforeAll(async () => {
@@ -51,7 +51,7 @@ describe('DataUnionEndPoints', () => {
5151

5252
// fresh dataUnion for each test case, created NOT in parallel to avoid nonce troubles
5353
const adminMutex = new Mutex()
54-
async function deployDataUnionSync(testName) {
54+
async function deployDataUnionSync(testName: string) {
5555
let dataUnion: DataUnion
5656
await adminMutex.runExclusive(async () => {
5757
const dataUnionName = testName + Date.now()
@@ -74,7 +74,7 @@ describe('DataUnionEndPoints', () => {
7474
}
7575
)
7676
})
77-
return dataUnion
77+
return dataUnion!
7878
}
7979

8080
describe('Admin', () => {

test/integration/dataunion/deploy.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const createMockAddress = () => '0x000000000000000000000000000' + Date.now()
1515

1616
describe('DataUnion deployment', () => {
1717

18-
let adminClient
18+
let adminClient: StreamrClient
1919

2020
beforeAll(async () => {
2121
log(`Connecting to Ethereum networks, config = ${JSON.stringify(config)}`)

tsconfig.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
"outDir": "dist",
99
"strict": true,
1010
"esModuleInterop": true,
11-
"resolveJsonModule": true
11+
"resolveJsonModule": true,
12+
"moduleResolution": "node"
1213
},
13-
"include": ["src/**/*"],
14+
"include": ["src/**/*", "contracts/*"],
1415
"exclude": ["node_modules", "dist"]
15-
}
16+
}

tsconfig.test.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": ["src/**/*", "contracts/**/*", "test/**/*"],
4+
"exclude": ["node_modules", "dist", "test/legacy/*"]
5+
}

0 commit comments

Comments
 (0)