Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Commit f62b8ca

Browse files
committed
AEROGEAR-8183 initial test structure
1 parent c274a2b commit f62b8ca

File tree

9 files changed

+3845
-1224
lines changed

9 files changed

+3845
-1224
lines changed

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@ reports/
1919
junit.xml
2020

2121
# Node modules
22-
node_modules/
22+
node_modules/
23+
24+
# Intellij files
25+
.idea
26+
*.iml

package-lock.json

+3,781-1,215
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "@aerogear/apollo-voyager-server-monorepo",
33
"private": true,
44
"scripts": {
5-
"test": "echo ok",
6-
"bootstrap": "lerna bootstrap --no-ci",
5+
"test": "lerna exec -- npm test",
6+
"bootstrap": "lerna bootstrap --no-ci",
77
"clean": "lerna clean --yes",
88
"lint": "tslint '*/*/src/**/*.ts' '*/*/test/**/*.ts'",
99
"format": "tslint '*/*/src/**/*.ts' '*/*/test/**/*.ts' --fix",
@@ -20,8 +20,10 @@
2020
"@types/keycloak-connect": "^4.5.0",
2121
"@types/node": "^10.12.10",
2222
"@types/pino": "^5.8.2",
23+
"ava": "1.0.0-rc.2",
2324
"graphql": "^0.13.2",
2425
"lerna": "^3.4.3",
26+
"ts-node": "^7.0.1",
2527
"tslint": "^5.11.0",
2628
"typescript": "^3.1.6"
2729
}

packages/apollo-voyager-context/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"compile": "tsc --build tsconfig.json",
88
"watch": "tsc --build tsconfig.json --watch",
9-
"test": "echo \"Error: no test specified\" && exit 1",
9+
"test": "exit 0",
1010
"compile:clean": "tsc --build tsconfig.json --clean"
1111
},
1212
"author": "AeroGear Team<[email protected]>",

packages/apollo-voyager-keycloak/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"compile": "tsc --build tsconfig.json",
2121
"watch": "tsc --build tsconfig.json --watch",
2222
"compile:clean": "tsc --build tsconfig.json --clean",
23-
"test": "echo \"Error: run tests from root\" && exit 1"
23+
"test": "exit 0"
2424
},
2525
"dependencies": {
2626
"@aerogear/apollo-voyager-server": "^1.0.0",

packages/apollo-voyager-metrics/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"compile": "tsc --build tsconfig.json",
2121
"watch": "tsc --build tsconfig.json --watch",
2222
"compile:clean": "tsc --build tsconfig.json --clean",
23-
"test": "echo \"Error: run tests from root\" && exit 1"
23+
"test": "exit 0"
2424
},
2525
"dependencies": {
2626
"prom-client": "^11.2.0",

packages/apollo-voyager-server/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"compile": "tsc --build tsconfig.json",
2121
"watch": "tsc --build tsconfig.json --watch",
2222
"compile:clean": "tsc --build tsconfig.json --clean",
23-
"test": "echo \"Error: run tests from root\" && exit 1"
23+
"test": "exit 0"
2424
},
2525
"dependencies": {
2626
"@aerogear/apollo-voyager-context": "^1.0.0",

packages/apollo-voyager-tools/package.json

+16-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,23 @@
66
"scripts": {
77
"compile": "tsc --build tsconfig.json",
88
"watch": "tsc --build tsconfig.json --watch",
9-
"test": "echo \"Error: no test specified\" && exit 1",
9+
"test": "ava '*.test.ts' '**/*.test.ts'",
1010
"compile:clean": "tsc --build tsconfig.json --clean"
1111
},
12+
"devDependencies": {
13+
"ava": "1.0.0-rc.2",
14+
"ts-node": "^7.0.1",
15+
"typescript": "^3.1.6"
16+
},
1217
"author": "AeroGear Team<[email protected]>",
13-
"license": "Apache-2.0"
18+
"license": "Apache-2.0",
19+
"ava": {
20+
"compileEnhancements": false,
21+
"extensions": [
22+
"ts"
23+
],
24+
"require": [
25+
"ts-node/register"
26+
]
27+
}
1428
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import test from 'ava'
2+
3+
import { buildPath } from './buildPath'
4+
5+
test('buildPath should never throw error', t => {
6+
t.is(buildPath(undefined), '')
7+
t.is(buildPath(null), '')
8+
t.is(buildPath(''), '')
9+
t.is(buildPath(1), '')
10+
t.is(buildPath({}), '')
11+
})
12+
13+
test('buildPath should build path successfully', t => {
14+
t.deepEqual(
15+
buildPath(
16+
{
17+
key: 'allMemes'
18+
}
19+
),
20+
'allMemes')
21+
22+
t.deepEqual(
23+
buildPath(
24+
{
25+
key: 'owner',
26+
prev: {
27+
key: '0',
28+
prev: {
29+
key: 'allMemes'
30+
}
31+
}
32+
}
33+
),
34+
'allMemes.0.owner')
35+
})

0 commit comments

Comments
 (0)