@oncehub/knowledgeowl-angular 4.1.6 → 4.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/knowledgeowl-angular/esm2020/knowledgeowl-angular.mjs +5 -0
  2. package/dist/knowledgeowl-angular/esm2020/lib/index.mjs +3 -0
  3. package/dist/knowledgeowl-angular/esm2020/lib/knowledge-owl-link/knowledge-owl-link-module.mjs +18 -0
  4. package/dist/knowledgeowl-angular/esm2020/lib/knowledge-owl-link/knowledge-owl-link.mjs +92 -0
  5. package/dist/knowledgeowl-angular/esm2020/lib/knowledge-owl-link/knowledge-owl-widget-errors.mjs +3 -0
  6. package/dist/knowledgeowl-angular/esm2020/lib/knowledge-owl-link/public-api.mjs +3 -0
  7. package/dist/knowledgeowl-angular/esm2020/lib/knowledge-owl-widget/knowledge-owl-widget-errors.mjs +4 -0
  8. package/dist/knowledgeowl-angular/esm2020/lib/knowledge-owl-widget/knowledge-owl-widget-module.mjs +19 -0
  9. package/dist/knowledgeowl-angular/esm2020/lib/knowledge-owl-widget/knowledge-owl-widget.mjs +143 -0
  10. package/dist/knowledgeowl-angular/esm2020/lib/knowledge-owl-widget/public-api.mjs +3 -0
  11. package/dist/knowledgeowl-angular/esm2020/public_api.mjs +2 -0
  12. package/dist/knowledgeowl-angular/fesm2015/knowledgeowl-angular.mjs +279 -0
  13. package/dist/knowledgeowl-angular/fesm2015/knowledgeowl-angular.mjs.map +1 -0
  14. package/dist/knowledgeowl-angular/fesm2020/knowledgeowl-angular.mjs +275 -0
  15. package/dist/knowledgeowl-angular/fesm2020/knowledgeowl-angular.mjs.map +1 -0
  16. package/dist/knowledgeowl-angular/index.d.ts +5 -0
  17. package/dist/knowledgeowl-angular/lib/knowledge-owl-link/knowledge-owl-link-module.d.ts +8 -0
  18. package/dist/knowledgeowl-angular/lib/knowledge-owl-link/knowledge-owl-link.d.ts +37 -0
  19. package/dist/knowledgeowl-angular/lib/knowledge-owl-link/knowledge-owl-widget-errors.d.ts +2 -0
  20. package/dist/knowledgeowl-angular/lib/knowledge-owl-widget/knowledge-owl-widget-errors.d.ts +3 -0
  21. package/dist/knowledgeowl-angular/lib/knowledge-owl-widget/knowledge-owl-widget-module.d.ts +8 -0
  22. package/dist/knowledgeowl-angular/lib/knowledge-owl-widget/knowledge-owl-widget.d.ts +63 -0
  23. package/dist/knowledgeowl-angular/package.json +37 -0
  24. package/package.json +4 -4
  25. package/.eslintrc.json +0 -82
  26. package/.github/workflows/codeql-analysis.yml +0 -71
  27. package/.github/workflows/npm-publish.yml +0 -23
  28. package/.lighthouse/jenkins-x/Kptfile +0 -11
  29. package/.lighthouse/jenkins-x/pullrequest.yaml +0 -278
  30. package/.lighthouse/jenkins-x/release.yaml +0 -269
  31. package/.lighthouse/jenkins-x/triggers.yaml +0 -19
  32. package/.prettierignore +0 -2
  33. package/.prettierrc +0 -3
  34. package/.travis.yml +0 -3
  35. package/CHANGELOG.md +0 -250
  36. package/OWNERS +0 -4
  37. package/OWNERS_ALIASES +0 -25
  38. package/angular.json +0 -47
  39. package/deploy.sh +0 -19
  40. package/package-deploy/npm-login.js +0 -14
  41. package/src/lib/knowledge-owl-link/index.ts +0 -1
  42. package/src/lib/knowledge-owl-link/knowledge-owl-link-module.ts +0 -10
  43. package/src/lib/knowledge-owl-link/knowledge-owl-link.spec.ts +0 -51
  44. package/src/lib/knowledge-owl-link/knowledge-owl-link.ts +0 -97
  45. package/src/lib/knowledge-owl-link/knowledge-owl-widget-errors.ts +0 -3
  46. package/src/lib/knowledge-owl-widget/index.ts +0 -1
  47. package/src/lib/knowledge-owl-widget/knowledge-owl-widget-errors.ts +0 -6
  48. package/src/lib/knowledge-owl-widget/knowledge-owl-widget-module.ts +0 -11
  49. package/src/lib/knowledge-owl-widget/knowledge-owl-widget.spec.ts +0 -66
  50. package/src/lib/knowledge-owl-widget/knowledge-owl-widget.ts +0 -162
  51. package/src/lib/tsconfig.json +0 -10
  52. package/src/ng-package.json +0 -7
  53. package/src/package-lock.json +0 -117
  54. package/src/package.json +0 -14
  55. package/src/polyfills.ts +0 -76
  56. package/src/tsconfig.lib.json +0 -31
  57. package/src/tsconfig.spec.json +0 -18
  58. package/test/karma.conf.js +0 -44
  59. package/test/test.ts +0 -24
  60. package/tsconfig.json +0 -34
  61. package/tsconfig.lib.prod.json +0 -9
  62. /package/{src → dist/knowledgeowl-angular}/README.md +0 -0
  63. /package/{src/lib/index.ts → dist/knowledgeowl-angular/lib/index.d.ts} +0 -0
  64. /package/{src/lib/knowledge-owl-link/public-api.ts → dist/knowledgeowl-angular/lib/knowledge-owl-link/public-api.d.ts} +0 -0
  65. /package/{src/lib/knowledge-owl-widget/public-api.ts → dist/knowledgeowl-angular/lib/knowledge-owl-widget/public-api.d.ts} +0 -0
  66. /package/{src/public_api.ts → dist/knowledgeowl-angular/public_api.d.ts} +0 -0
package/CHANGELOG.md DELETED
@@ -1,250 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [4.1.3] - 2023-07-17
9
-
10
- - [ONCEHUB-70228] semver vulnerability has been fixed in project knowledgeowl-angular
11
-
12
- ## [4.1.2] - 2023-07-03
13
-
14
- - [ONCEHUB-69553] word-wrap vulnerability has been fixed in project knowledgeowl-angular
15
- - [ONCEHUB-65621] webpack vulnerability has been fixed in project knowledgeowl-angular
16
-
17
- ## [4.1.1] - 2023-06-14
18
-
19
- - [ONCEHUB-62023] engine.io, socket.io, socket.io-parser vulnerability has been fixed in project knowledgeowl-angular
20
-
21
- ## [4.0.9] - 2023-01-04
22
-
23
- - [ONCEHUB-62023](https://scheduleonce.atlassian.net/browse/ONCEHUB-62023): CVE-2022-46175 vulnerability found in package json5 in project knowledgeowl-angular
24
-
25
- ## [4.0.8] - 2022-12-13
26
-
27
- - [ONCEHUB-60847](https://scheduleonce.atlassian.net/browse/ONCEHUB-60847): CVE-2022-38900 vulnerability found in package decode-uri-component
28
-
29
- ## [4.0.7] - 2022-11-22
30
-
31
- ### Updated
32
-
33
- - [ONCEHUB-60383](https://scheduleonce.atlassian.net/browse/ONCEHUB-60383): CVE-2022-37603 vulnerability found in package loader-utils
34
- - [ONCEHUB-60450](https://scheduleonce.atlassian.net/browse/ONCEHUB-60450): CVE-2022-41940 vulnerability found in package engine.io
35
-
36
- ## [4.0.6] - 2022-11-09
37
-
38
- ### Updated
39
-
40
- - Fixed loader-utils vulnerability.
41
-
42
- ## [4.0.5] - 2022-10-31
43
-
44
- ### Updated
45
-
46
- - Fixed socket.io-parser vulnerability.
47
-
48
- ## [4.0.4] - 2022-07-21
49
-
50
- ### Updated
51
-
52
- - Updated @angular-devkit/build-angular packges to v13 latest.
53
-
54
- ## [4.0.3] - 2022-07-06
55
-
56
- ### Added
57
-
58
- - Added readme documentation on NPM.
59
-
60
- ## [4.0.2] - 2022-04-28
61
-
62
- ### Added
63
-
64
- - NA
65
-
66
- ### Changed
67
-
68
- - NA
69
-
70
- ### Removed
71
-
72
- - NA
73
-
74
- ### Fixed
75
-
76
- - Vulnerability fixes [ONCEHUB-53689](https://scheduleonce.atlassian.net/browse/ONCEHUB-53689)
77
-
78
- ## [4.0.0] - 2022-03-01
79
-
80
- ### Added
81
-
82
- - NA
83
-
84
- ### Changed
85
-
86
- - Updated project knowledgeowl-angular to use Angular 13
87
-
88
- ### Removed
89
-
90
- - NA
91
-
92
- ### Fixed
93
-
94
- - NA
95
-
96
- ## [3.0.2] - 2022-02-07
97
-
98
- ### Added
99
-
100
- - NA
101
-
102
- ### Changed
103
-
104
- - NA
105
-
106
- ### Removed
107
-
108
- - NA
109
-
110
- ### Fixed
111
-
112
- - [`ONCEHUB-50833`](https://scheduleonce.atlassian.net/browse/ONCEHUB-50833) Fixed package vulnerabilities
113
- - [`ONCEHUB-50603`](https://scheduleonce.atlassian.net/browse/ONCEHUB-50603) Fixed package vulnerabilities
114
- - [`ONCEHUB-47262`](https://scheduleonce.atlassian.net/browse/ONCEHUB-47262) Fixed package vulnerabilities
115
-
116
- ## [3.0.1] - 2022-01-24
117
-
118
- ### Added
119
-
120
- - NA
121
-
122
- ### Changed
123
-
124
- - NA
125
-
126
- ### Removed
127
-
128
- - NA
129
-
130
- ### Fixed
131
-
132
- - [`ONCEHUB-50115`](https://scheduleonce.atlassian.net/browse/ONCEHUB-50115) Fixed package vulnerabilities
133
- - [`ONCEHUB-50604`](https://scheduleonce.atlassian.net/browse/ONCEHUB-50604) Fixed package vulnerabilities
134
- - [`ONCEHUB-50609`](https://scheduleonce.atlassian.net/browse/ONCEHUB-50609) Fixed package vulnerabilities
135
- - [`ONCEHUB-50641`](https://scheduleonce.atlassian.net/browse/ONCEHUB-50641) Fixed package vulnerabilities
136
- - [`ONCEHUB-50756`](https://scheduleonce.atlassian.net/browse/ONCEHUB-50756) Fixed package vulnerabilities
137
-
138
- ## [2.0.4] - 2021-06-23
139
-
140
- ### Added
141
-
142
- - NA
143
-
144
- ### Changed
145
-
146
- - NA
147
-
148
- ### Removed
149
-
150
- - NA
151
-
152
- ### Fixed
153
-
154
- - [`ONCEHUB-43676`](https://scheduleonce.atlassian.net/browse/ONCEHUB-43676) Fixed package vulnerabilities
155
- - [`ONCEHUB-42560`](https://scheduleonce.atlassian.net/browse/ONCEHUB-42560) Fixed package vulnerabilities
156
- - [`ONCEHUB-42564`](https://scheduleonce.atlassian.net/browse/ONCEHUB-42564) Fixed package vulnerabilities
157
- - [`ONCEHUB-43237`](https://scheduleonce.atlassian.net/browse/ONCEHUB-43237) Fixed package vulnerabilities
158
-
159
- ## [2.0.1] - 2021-04-16
160
-
161
- ### Added
162
-
163
- - NA
164
-
165
- ### Changed
166
-
167
- - NA
168
-
169
- ### Removed
170
-
171
- - NA
172
-
173
- ### Fixed
174
-
175
- - [`ONCEHUB-40864`](https://scheduleonce.atlassian.net/browse/ONCEHUB-40864) Fixed package vulnerabilities for ssri
176
-
177
- ## [1.0.0] - 2020-09-15
178
-
179
- ### Added
180
-
181
- - NA
182
-
183
- ### Changed
184
-
185
- - Updated project knowledgeowl-angular to use Angular 9
186
-
187
- ### Removed
188
-
189
- - NA
190
-
191
- ### Fixed
192
-
193
- - [`ONCEHUB-32452`](https://scheduleonce.atlassian.net/browse/ONCEHUB-32452) Fixed package vulnerabilities for npm-registry-fetch
194
-
195
- ## [0.1.9] - 2020-07-07
196
-
197
- ### Added
198
-
199
- - NA
200
-
201
- ### Changed
202
-
203
- - NA
204
-
205
- ### Removed
206
-
207
- - NA
208
-
209
- ### Fixed
210
-
211
- - [`ONCEHUB-32349`](https://scheduleonce.atlassian.net/browse/ONCEHUB-32349) Fixed package vulnerabilities
212
-
213
- ## [0.1.8] - 2019-09-02
214
-
215
- ### Added
216
-
217
- - NA
218
-
219
- ### Changed
220
-
221
- - Converted knowledgeOwlLink component into directive [`ONCEHUB-16716`](https://scheduleonce.atlassian.net/browse/ONCEHUB-16716)
222
-
223
- ### Removed
224
-
225
- - NA
226
-
227
- ### Fixed
228
-
229
- -NA
230
-
231
- ## [0.1.7] - 2019-08-20
232
-
233
- ### Added
234
-
235
- - NA
236
-
237
- ### Changed
238
-
239
- - NA
240
-
241
- ### Removed
242
-
243
- - NA
244
-
245
- ### Fixed
246
-
247
- Dependency upgrades
248
-
249
- - [`ONCEHUB-15146`](https://scheduleonce.atlassian.net/browse/ONCEHUB-15146)
250
- - [`ONCEHUB-15340`](https://scheduleonce.atlassian.net/browse/ONCEHUB-15340)
package/OWNERS DELETED
@@ -1,4 +0,0 @@
1
- approvers:
2
- - developers
3
- reviewers:
4
- - developers
package/OWNERS_ALIASES DELETED
@@ -1,25 +0,0 @@
1
- aliases:
2
- developers:
3
- - so-nagender
4
- - anurag-arya
5
- - amitbishtOH
6
- - pkotiyalso
7
- - mderazon
8
- - so-abahadur
9
- - amanpreetSO
10
- - AmitPandeyScheduleonce
11
- - ashishsatiSO
12
- - SO-ashusrivastava
13
- - Bharat Singh
14
- - giladgoraly
15
- - sohimanshu
16
- - so-kaushal
17
- - nalingarg
18
- - so-sdhawan
19
- - ShivamKe
20
- - ushankar208
21
- - vaibhavso
22
- - vinaykumar01
23
- - yoramwso
24
- - SoniRani
25
- - sumitsharma22
package/angular.json DELETED
@@ -1,47 +0,0 @@
1
- {
2
- "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
- "cli": {
4
- "analytics": "47c16505-5eb3-4e8a-a186-dc68f7f3ea3b"
5
- },
6
- "version": 1,
7
- "newProjectRoot": "projects",
8
- "projects": {
9
- "knowledgeowl-angular": {
10
- "root": "",
11
- "sourceRoot": "src",
12
- "projectType": "library",
13
- "prefix": "",
14
- "architect": {
15
- "build": {
16
- "builder": "@angular-devkit/build-angular:ng-packagr",
17
- "options": {
18
- "tsConfig": "src/tsconfig.lib.json",
19
- "project": "src/ng-package.json"
20
- },
21
- "configurations": {
22
- "production": {
23
- "tsConfig": "tsconfig.lib.prod.json"
24
- }
25
- }
26
- },
27
- "test": {
28
- "builder": "@angular-devkit/build-angular:karma",
29
- "options": {
30
- "main": "test/test.ts",
31
- "tsConfig": "src/tsconfig.spec.json",
32
- "karmaConfig": "test/karma.conf.js"
33
- }
34
- },
35
- "lint": {
36
- "builder": "@angular-eslint/builder:lint",
37
- "options": {
38
- "lintFilePatterns": [
39
- "src/**/*.ts",
40
- "src/**/*.html"
41
- ]
42
- }
43
- }
44
- }
45
- }
46
- }
47
- }
package/deploy.sh DELETED
@@ -1,19 +0,0 @@
1
- #!/bin/sh
2
- set -e
3
-
4
- node package-deploy/npm-login.js $(cat "/etc/npm-cred/NPM_AUTH_TOKEN")
5
- npm whoami
6
- npm i
7
- chown root:root .
8
- npm run package
9
- filename="$(npm pack --dry-run | tail -n 1)"
10
- echo "$1"
11
-
12
- if [[ "$1" == "qa" ]] || [[ "$1" == "master" ]] || [[ "$1" == "staging" ]] || [[ "$1" == "staging-app2" ]]
13
- then
14
- npm publish dist/knowledgeowl-angular/$filename --registry=https://registry.npmjs.org/
15
- else
16
- npm publish --tag beta dist/knowledgeowl-angular/$filename --registry=https://registry.npmjs.org/
17
- fi
18
-
19
- echo "$filename package pushed to NPM successfully"
@@ -1,14 +0,0 @@
1
- let fs = require('fs');
2
- let path = require('path');
3
-
4
- let token = '';
5
-
6
- process.argv.forEach(function(val, index, array) {
7
- if (index == 2) token = val;
8
- });
9
-
10
- let registry = '//registry.npmjs.org/';
11
-
12
- var configPath = configPath ? configPath : path.join(__dirname, '../', '.npmrc');
13
-
14
- fs.writeFile(configPath, `${registry}:_authToken=${token}` + '\n', (err, message) => { if(err){ console.log(err , message)}});
@@ -1 +0,0 @@
1
- export * from './public-api';
@@ -1,10 +0,0 @@
1
- import { CommonModule } from '@angular/common';
2
- import { NgModule } from '@angular/core';
3
- import { KnowledgeOwlLink } from './knowledge-owl-link';
4
-
5
- @NgModule({
6
- imports: [CommonModule],
7
- exports: [KnowledgeOwlLink],
8
- declarations: [KnowledgeOwlLink],
9
- })
10
- export class KnowledgeOwlLinkModule {}
@@ -1,51 +0,0 @@
1
- import { Component, Provider, Type } from '@angular/core';
2
- import { ComponentFixture, TestBed } from '@angular/core/testing';
3
- import { KnowledgeOwlLinkModule } from './index';
4
- import { getKnowledgeLinkArticleMissingError } from './knowledge-owl-widget-errors';
5
-
6
- @Component({
7
- template: `<a knowledgeOwlLink>Test link</a>`,
8
- })
9
- class KnowledgeOwlLinkWithoutArticle {}
10
-
11
- @Component({
12
- template: `
13
- <a knowledgeOwlLink="https://knowledgeowl.article.com/help/test-article"
14
- >Test link</a
15
- >
16
- `,
17
- })
18
- class KnowledgeOwlLinkWithValidInputs {}
19
-
20
- describe('KnowledgeOwl link with missing credentials', () => {
21
- it('should throw error without knowledgeOwlLink', () => {
22
- const fixture = createComponent(KnowledgeOwlLinkWithoutArticle, [
23
- { provide: 'KOProjectURL', useValue: 'https://knowledgeowl.com' },
24
- ]);
25
- expect(() => fixture.detectChanges()).toThrowError(
26
- getKnowledgeLinkArticleMissingError().message
27
- );
28
- });
29
- });
30
-
31
- describe('KnowledgeOwl link', () => {
32
- it('should not throw error when given correct inputs', () => {
33
- const fixture = createComponent(KnowledgeOwlLinkWithValidInputs, [
34
- { provide: 'KOProjectURL', useValue: 'https://knowledgeowl.com' },
35
- ]);
36
- expect(() => fixture.detectChanges()).not.toThrowError();
37
- });
38
- });
39
-
40
- const createComponent = <T>(
41
- component: Type<T>,
42
- providers: Provider[] = []
43
- ): ComponentFixture<T> => {
44
- TestBed.configureTestingModule({
45
- imports: [KnowledgeOwlLinkModule],
46
- declarations: [component],
47
- providers,
48
- }).compileComponents();
49
-
50
- return TestBed.createComponent<T>(component);
51
- };
@@ -1,97 +0,0 @@
1
- import {
2
- AfterContentInit,
3
- ElementRef,
4
- HostListener,
5
- Inject,
6
- Input,
7
- Directive,
8
- } from '@angular/core';
9
- import { getKnowledgeLinkArticleMissingError } from './knowledge-owl-widget-errors';
10
-
11
- /**
12
- * Knowledge Owl Link
13
- */
14
- @Directive({
15
- selector: `a[knowledgeOwlLink]`,
16
- exportAs: 'knowledgeOwlLink',
17
- })
18
- export class KnowledgeOwlLink implements AfterContentInit {
19
- @Input()
20
- knowledgeOwlLink: string;
21
-
22
- constructor(
23
- protected elementRef: ElementRef,
24
- @Inject('KOProjectURL') private projectURL: string
25
- ) {}
26
-
27
- getHostElement(): HTMLElement {
28
- return this.elementRef.nativeElement;
29
- }
30
-
31
- ngAfterContentInit(): void {
32
- this._validateLinkInputs();
33
- this._initLink();
34
- }
35
-
36
- @HostListener('click', ['$event'])
37
- openArticle(event: Event): void {
38
- event.preventDefault();
39
- // Convert the KO link into the widget link
40
- let widgetHref;
41
- if (this.knowledgeOwlLink.includes('#')) {
42
- const widgetlink = this.knowledgeOwlLink.split('#');
43
- const widgetlink1 =
44
- widgetlink[0].replace('/help/', '/help/fetch-article/hash/') +
45
- '?widget=true';
46
- const widgetlink2 = '#' + widgetlink[1];
47
- widgetHref = widgetlink1.concat(widgetlink2);
48
- } else {
49
- widgetHref =
50
- this.knowledgeOwlLink.replace('/help/', '/help/fetch-article/hash/') +
51
- '?widget=true';
52
- }
53
-
54
- if (window['__ko16']) {
55
- // Wait until widget loads completely
56
- window['__ko16'].openArticle(widgetHref);
57
- }
58
- }
59
-
60
- /**
61
- * Private methods
62
- */
63
-
64
- /**
65
- * Initialize link
66
- *
67
- * @private
68
- */
69
- private _initLink() {
70
- this.knowledgeOwlLink = `${this.projectURL}/help/${this.knowledgeOwlLink}`; // Updating article link to have complete URL
71
- const nativeElement = this.getHostElement();
72
- if (nativeElement.tagName === 'A') {
73
- // Updating link for <a>
74
- nativeElement.setAttribute('href', this.knowledgeOwlLink);
75
- }
76
- }
77
-
78
- /**
79
- * Validates all required inputs of knowledge-owl-link
80
- *
81
- * @private
82
- */
83
- private _validateLinkInputs() {
84
- this._validateArticlePresence();
85
- }
86
-
87
- /**
88
- * Validates presence of article URL for link
89
- *
90
- * @private
91
- */
92
- private _validateArticlePresence() {
93
- if (!this.knowledgeOwlLink) {
94
- throw getKnowledgeLinkArticleMissingError();
95
- }
96
- }
97
- }
@@ -1,3 +0,0 @@
1
- /** @docs-private */
2
- export const getKnowledgeLinkArticleMissingError = (): Error =>
3
- Error('knowledge-owl-link requires article URL as input.');
@@ -1 +0,0 @@
1
- export * from './public-api';
@@ -1,6 +0,0 @@
1
- /** @docs-private */
2
- export const getKnowledgeWidgetPoductKeyMissingError = (): Error =>
3
- Error('knowledge-owl-widget requires product key as input.');
4
-
5
- export const getKnowledgeWidgetInvalidProductURLError = (): Error =>
6
- Error('knowledge-owl-widget requires valid product URL as provider.');
@@ -1,11 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
- import { KnowledgeOwlWidget } from './knowledge-owl-widget';
4
-
5
- @NgModule({
6
- imports: [CommonModule],
7
- exports: [KnowledgeOwlWidget],
8
- declarations: [KnowledgeOwlWidget],
9
- providers: [],
10
- })
11
- export class KnowledgeOwlWidgetModule {}
@@ -1,66 +0,0 @@
1
- import { Component, Provider, Type } from '@angular/core';
2
- import { ComponentFixture, TestBed } from '@angular/core/testing';
3
- import { KnowledgeOwlWidgetModule } from './index';
4
- import {
5
- getKnowledgeWidgetPoductKeyMissingError,
6
- getKnowledgeWidgetInvalidProductURLError,
7
- } from './knowledge-owl-widget-errors';
8
-
9
- @Component({
10
- template: `<knowledge-owl-widget></knowledge-owl-widget>`,
11
- })
12
- class KnowledgeOwlWidgetWithoutCredentials {}
13
-
14
- @Component({
15
- template: `<knowledge-owl-widget></knowledge-owl-widget>`,
16
- })
17
- class KnowledgeOwlWidgetWithoutProjectKey {}
18
-
19
- @Component({
20
- template: `
21
- <knowledge-owl-widget [projectKey]="'testkey'"></knowledge-owl-widget>
22
- `,
23
- })
24
- class KnowledgeOwlWidgetWithCredentials {}
25
-
26
- describe('KnowledgeOwl widget with missing credentials', () => {
27
- it('should throw KnowledgeWidgetProductURLMissingError error', () => {
28
- const fixture = createComponent(KnowledgeOwlWidgetWithoutCredentials, [
29
- { provide: 'KOProjectURL', useValue: 'https://' },
30
- ]);
31
- expect(() => fixture.detectChanges()).toThrowError(
32
- getKnowledgeWidgetInvalidProductURLError().message
33
- );
34
- });
35
-
36
- it('should throw KnowledgeWidgetProductKeyMissingError error', () => {
37
- const fixture = createComponent(KnowledgeOwlWidgetWithoutProjectKey, [
38
- { provide: 'KOProjectURL', useValue: 'https://knowledgeowl.com' },
39
- ]);
40
- expect(() => fixture.detectChanges()).toThrowError(
41
- getKnowledgeWidgetPoductKeyMissingError().message
42
- );
43
- });
44
- });
45
-
46
- describe('KnowledgeOwl widget', () => {
47
- it('should not throw error when given correct inputs', () => {
48
- const fixture = createComponent(KnowledgeOwlWidgetWithCredentials, [
49
- { provide: 'KOProjectURL', useValue: 'https://knowledgeowl.com' },
50
- ]);
51
- expect(() => fixture.detectChanges()).not.toThrowError();
52
- });
53
- });
54
-
55
- const createComponent = <T>(
56
- component: Type<T>,
57
- providers: Provider[] = []
58
- ): ComponentFixture<T> => {
59
- TestBed.configureTestingModule({
60
- imports: [KnowledgeOwlWidgetModule],
61
- declarations: [component],
62
- providers,
63
- }).compileComponents();
64
-
65
- return TestBed.createComponent<T>(component);
66
- };