Skip to content

Commit 51a72aa

Browse files
Kamu 108 Unit Tests Coverage (#51)
* Upgraded to latest version of Jasmine framework * Written over 200 unit tests for almost all existing components and services * Corrections in the code detected by unit tests * Configured coverage reporting during testing * Enabled Jasmine plugin for ESLint * Upgraded to latest GraphQL schema
1 parent ef0a0c2 commit 51a72aa

File tree

97 files changed

+5697
-1155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+5697
-1155
lines changed

.eslintrc

+8-5
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,18 @@
99
"plugin:@typescript-eslint/recommended",
1010
"plugin:@typescript-eslint/recommended-requiring-type-checking",
1111
"plugin:@typescript-eslint/eslint-recommended",
12-
"plugin:@typescript-eslint/strict"
12+
"plugin:@typescript-eslint/strict",
13+
"plugin:jasmine/recommended"
1314
],
1415
"parser": "@typescript-eslint/parser",
15-
"plugins": ["@typescript-eslint"],
16+
"plugins": ["@typescript-eslint", "jasmine"],
17+
"env": {
18+
"jasmine": true
19+
},
1620
"rules": {
1721
"no-bitwise": 0,
18-
"@typescript-eslint/no-extraneous-class": [
19-
"off"
20-
]
22+
"@typescript-eslint/no-extraneous-class": ["off"],
23+
"jasmine/new-line-before-expect": 0
2124
},
2225
"ignorePatterns": ["node_modules", "dist", "kamu.graphql.interface.ts"]
2326
}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/.angular/cache
22
/node_modules
33
/dist
4+
/coverage

e2e/src/app.e2e-spec.ts

+13-7
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,24 @@ describe("workspace-project App", () => {
88
page = new AppPage();
99
});
1010

11-
it("should display welcome message", async () => {
12-
await page.navigateTo();
13-
await expect(page.getTitleText()).toEqual("kamu-platform app is running!");
14-
});
15-
16-
afterEach(async () => {
17-
// Assert that there are no errors emitted from the browser
11+
async function checkNoErrorsInLog(): Promise<void> {
1812
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
1913
expect(logs).not.toContain(
2014
jasmine.objectContaining({
2115
level: logging.Level.SEVERE,
2216
} as logging.Entry),
2317
);
18+
}
19+
20+
it("should display welcome message", async () => {
21+
await page.navigateTo();
22+
expect(await page.getTitleText()).toEqual(
23+
"kamu-platform app is running!",
24+
);
25+
});
26+
27+
afterEach(async () => {
28+
// Assert that there are no errors emitted from the browser
29+
await checkNoErrorsInLog();
2430
});
2531
});

e2e/tsconfig.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
"target": "es2018",
77
"types": [
88
"jasmine",
9-
"jasminewd2",
109
"node"
1110
]
1211
}
13-
}
12+
}

karma.conf.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = function (config) {
88
plugins: [
99
require("karma-jasmine"),
1010
require("karma-chrome-launcher"),
11-
require('karma-firefox-launcher'),
11+
require("karma-firefox-launcher"),
1212
require("karma-jasmine-html-reporter"),
1313
require("karma-coverage-istanbul-reporter"),
1414
require("@angular-devkit/build-angular/plugins/karma"),
@@ -21,7 +21,7 @@ module.exports = function (config) {
2121
reports: ["html", "lcovonly", "text-summary"],
2222
fixWebpackSourcePaths: true,
2323
},
24-
reporters: ["progress", "kjhtml"],
24+
reporters: ["progress", "kjhtml", "coverage-istanbul"],
2525
port: 9876,
2626
colors: true,
2727
logLevel: config.LOG_INFO,

package-lock.json

+53-42
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+9-8
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"start": "ng serve --watch",
77
"build": "ng build",
88
"build-prod": "ng build --configuration production",
9-
"test": "ng test --no-watch --no-progress --browsers ChromeHeadless",
10-
"test-firefox": "ng test --no-progress --browsers Firefox",
9+
"test": "ng test --no-watch --no-progress --browsers ChromeHeadless --code-coverage",
10+
"test-firefox": "ng test --no-progress --browsers Firefox --code-coverage",
1111
"lint": "eslint . --ext .ts",
1212
"lint-and-fix": "eslint . --ext .ts --fix",
1313
"e2e": "ng e2e",
@@ -64,26 +64,27 @@
6464
"@graphql-codegen/cli": "^2.11.8",
6565
"@graphql-codegen/typescript-apollo-angular": "^3.3.1",
6666
"@graphql-codegen/typescript-operations": "^2.2.1",
67-
"@types/jasmine": "~3.4.0",
68-
"@types/jasminewd2": "~2.0.3",
67+
"@types/jasmine": "^4.3.0",
6968
"@types/lodash": "^4.14.182",
7069
"@types/node": "9.6.0",
7170
"@typescript-eslint/eslint-plugin": "^5.33.1",
7271
"@typescript-eslint/parser": "^5.33.1",
7372
"codelyzer": "^5.1.2",
7473
"eslint": "^8.22.0",
74+
"eslint-plugin-jasmine": "^4.1.3",
7575
"husky": "^8.0.0",
76-
"jasmine-core": "~3.5.0",
77-
"jasmine-spec-reporter": "~5.0.0",
76+
"jasmine": "^4.4.0",
77+
"jasmine-spec-reporter": "^7.0.0",
7878
"karma": "~6.4.0",
7979
"karma-chrome-launcher": "~3.1.0",
8080
"karma-coverage-istanbul-reporter": "~3.0.2",
8181
"karma-firefox-launcher": "^2.1.2",
82-
"karma-jasmine": "~4.0.0",
83-
"karma-jasmine-html-reporter": "^1.5.0",
82+
"karma-jasmine": "^5.1.0",
83+
"karma-jasmine-html-reporter": "^2.0.0",
8484
"prettier": "2.5.1",
8585
"pretty-quick": "^3.1.3",
8686
"protractor": "~7.0.0",
87+
"timekeeper": "^2.2.0",
8788
"ts-node": "~8.3.0",
8889
"typescript": "4.6.4"
8990
}

resources/schema.graphql

+10-3
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ type DatasetConnection {
163163
"""
164164
Approximate number of total nodes
165165
"""
166-
totalCount: Int
166+
totalCount: Int!
167167
"""
168168
Page information
169169
"""
@@ -313,6 +313,7 @@ type FetchStepUrl {
313313
url: String!
314314
eventTime: EventTimeSource
315315
cache: SourceCaching
316+
headers: [RequestHeader!]
316317
}
317318

318319

@@ -356,7 +357,7 @@ type MetadataBlockConnection {
356357
"""
357358
Approximate number of total nodes
358359
"""
359-
totalCount: Int
360+
totalCount: Int!
360361
"""
361362
Page information
362363
"""
@@ -374,6 +375,7 @@ type MetadataBlockExtended {
374375
systemTime: DateTime!
375376
author: Account!
376377
event: MetadataEvent!
378+
sequenceNumber: Int!
377379
}
378380

379381
type MetadataChain {
@@ -518,6 +520,11 @@ type ReadStepParquet {
518520
schema: [String!]
519521
}
520522

523+
type RequestHeader {
524+
name: String!
525+
value: String!
526+
}
527+
521528
type Search {
522529
"""
523530
Perform search across all resources
@@ -535,7 +542,7 @@ type SearchResultConnection {
535542
"""
536543
Approximate number of total nodes
537544
"""
538-
totalCount: Int
545+
totalCount: Int!
539546
"""
540547
Page information
541548
"""

0 commit comments

Comments
 (0)