Skip to content

Commit 21039ba

Browse files
committed
updating start project
1 parent e9ed9df commit 21039ba

File tree

15 files changed

+3987
-3658
lines changed

15 files changed

+3987
-3658
lines changed

UM-Start/package-lock.json

Lines changed: 3950 additions & 3436 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UM-Start/package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,39 @@
1616
"build:prd": "ng build --prod",
1717
"deploy:gh": "gh-pages -d dist",
1818
"publish": "run-s build:prd deploy:gh",
19-
"rnd" :"ts-node src/hot-cold/hot.ts"
19+
"rnd": "ts-node src/hot-cold/hot.ts"
2020
},
2121
"private": true,
2222
"dependencies": {
23-
"@angular/animations": "^6.0.3",
24-
"@angular/common": "^6.0.3",
25-
"@angular/compiler": "^6.0.3",
26-
"@angular/core": "^6.0.3",
27-
"@angular/forms": "^6.0.3",
28-
"@angular/http": "^6.0.3",
29-
"@angular/platform-browser": "^6.0.3",
30-
"@angular/platform-browser-dynamic": "^6.0.3",
31-
"@angular/router": "^6.0.3",
23+
"@angular/animations": "^7.1.3",
24+
"@angular/common": "^7.1.3",
25+
"@angular/compiler": "^7.1.3",
26+
"@angular/core": "^7.1.3",
27+
"@angular/forms": "^7.1.3",
28+
"@angular/http": "^7.1.3",
29+
"@angular/platform-browser": "^7.1.3",
30+
"@angular/platform-browser-dynamic": "^7.1.3",
31+
"@angular/router": "^7.1.3",
3232
"bootstrap": "^3.3.7",
3333
"core-js": "^2.5.4",
3434
"jquery": "^3.3.1",
3535
"popper.js": "^1.14.4",
36-
"rxjs": "^6.0.0",
36+
"rxjs": "^6.3.3",
3737
"zone.js": "^0.8.26"
3838
},
3939
"devDependencies": {
40-
"@angular-devkit/build-angular": "~0.6.8",
41-
"@angular/cli": "~6.0.8",
42-
"@angular/compiler-cli": "^6.0.3",
43-
"@angular/language-service": "^6.0.3",
40+
"@angular-devkit/build-angular": "0.11.3",
41+
"@angular/cli": "^7.1.3",
42+
"@angular/compiler-cli": "^7.1.3",
43+
"@angular/language-service": "^7.1.3",
4444
"@types/jasmine": "~2.8.6",
4545
"@types/jasminewd2": "~2.0.3",
4646
"@types/jest": "^23.3.5",
4747
"@types/node": "~8.9.4",
4848
"codelyzer": "~4.2.1",
4949
"gh-pages": "^1.2.0",
5050
"jasmine-core": "~2.99.1",
51-
"jasmine-marbles": "^0.4.0",
51+
"jasmine-marbles": "^0.4.1",
5252
"jasmine-spec-reporter": "~4.2.1",
5353
"jest": "^23.6.0",
5454
"jest-preset-angular": "^6.0.1",
@@ -64,6 +64,6 @@
6464
"protractor": "~5.3.0",
6565
"ts-node": "~5.0.1",
6666
"tslint": "~5.9.1",
67-
"typescript": "~2.7.2"
67+
"typescript": "^3.1.6"
6868
}
6969
}

UM-Start/src/app/api/user.api.spec.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,10 @@ describe('UserApi', () => {
1616
});
1717

1818
it('userApi is defined', () => {
19-
expect(userApi).toBeDefined();
19+
2020
});
2121

2222
it('can return all users', () => {
23-
const usersData = [
24-
{
25-
title: 'mr',
26-
first: 'thomas',
27-
last: 'lopez',
28-
29-
}
30-
];
31-
const expectedUsers = cold('--a|', { a: usersData });
32-
$http.get = jest.fn(() => expectedUsers);
33-
const result = userApi.getAllUsers();
3423

35-
expect(result).toBeObservable(expectedUsers);
36-
expect($http.get).toHaveBeenCalledWith('http://localhost:3000/users');
3724
});
3825
});

UM-Start/src/app/dashboard/dashboard.component.spec.ts

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -34,52 +34,19 @@ describe('DashboardComponent', () => {
3434
});
3535

3636
it('should create', () => {
37-
expect(component).toBeTruthy();
37+
3838
});
3939

4040
it('can search user by first name', () => {
41-
const expected$ = cold('-----a|', { a: [{ first: 'Rupesh' }] });
42-
userApi.searchUser = jest.fn(() => expected$);
4341

44-
component.search('Rupesh');
45-
getTestScheduler().flush();
46-
expect(component.users).toEqual([{ first: 'Rupesh' }]);
4742
});
4843

4944
it('RACE CONDITION: can search user by first name', () => {
50-
userApi.searchUser = jest.fn(() =>
51-
cold('--------a|', { a: [{ first: 'Rupesh' }] })
52-
);
53-
54-
component.search('Rupesh');
55-
56-
userApi.searchUser = jest.fn(() =>
57-
cold('--b|', { b: [{ first: 'Ritesh' }] })
58-
);
59-
60-
component.search('Ritesh');
61-
62-
getTestScheduler().flush();
6345

64-
expect(component.users).toEqual([{ first: 'Rupesh' }]);
6546
});
6647

6748
it('RACE CONDITION FIXED: can search user by first name', () => {
68-
userApi.searchUser = jest.fn(() =>
69-
cold('--------a|', { a: [{ first: 'Rupesh' }] })
70-
);
71-
72-
component.onKeyUp('Rupesh');
73-
74-
userApi.searchUser = jest.fn(() =>
75-
cold('--b|', { b: [{ first: 'Ritesh' }] })
76-
);
77-
78-
component.onKeyUp('Ritesh');
79-
80-
getTestScheduler().flush();
81-
82-
expect(component.users).toEqual([{ first: 'Ritesh' }]);
49+
8350
});
8451
});
8552

UM-Start/src/app/save-user/save-user.component.spec.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,10 @@ describe('SaveUserComponent', () => {
3434
});
3535

3636
it('should compile', () => {
37-
const user$ = cold('--a|', {
38-
a: { first: 'John', last: 'Paul', emailId: '[email protected]' }
39-
});
40-
userApi.getUserById = jest.fn(() => user$);
4137

42-
fixture.detectChanges();
43-
4438
});
4539

4640
it('should create', () => {
47-
expect(component).toBeTruthy();
41+
4842
});
4943
});

UM-Start/src/errors-syntaxes/errors.spec.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,15 @@ import { cold } from 'jasmine-marbles';
22
import { throwError, Observable } from 'rxjs';
33

44
describe('error', () => {
5-
it('test', () => {
6-
const s = throwError('error');
7-
expect(s).toBeObservable(cold('#'));
5+
it('throwError', () => {
6+
87
});
9-
it('should work with error with values', () => {
10-
const expected = cold('#', {}, new Error('server error'));
11-
const result = getData();
8+
it('should work with error', () => {
129

13-
expect(result).toBeObservable(expected);
1410
});
1511

1612
it('should work with value and error', () => {
17-
const expected = cold('(x#)', { x: 'orange' }, new Error('server error'));
18-
const result = getEmployees();
1913

20-
expect(result).toBeObservable(expected);
2114
});
2215
});
2316

UM-Start/src/hot-cold/cold-values.spec.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@ import { cold } from 'jasmine-marbles';
44

55
describe(' With Values ', () => {
66
it('should work with value', () => {
7-
const result = from(['orange']);
8-
const expected = cold('(x|)', { x: 'orange' });
97

10-
expect(result).toBeObservable(expected);
118
});
129

1310
it('should work with of operator with Array values', () => {
14-
const result = of(1, 2, 3);
15-
const expected = cold('(abc|)', { a: 1, b: 2, c: 3 });
16-
17-
expect(result).toBeObservable(expected);
11+
1812
});
1913

2014
});

UM-Start/src/hot-cold/cold.spec.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,17 @@ import { of, Observable, throwError, from } from 'rxjs';
33

44
describe('COLD', () => {
55
it('of with one value', () => {
6-
const provided = of('a');
76

8-
const expected = cold('(a|)');
9-
10-
expect(provided).toBeObservable(expected);
117
});
128

139
it('of with 2 values', () => {
14-
const provided1 = of('a', 'b');
15-
const expected = cold('(ab|)');
1610

17-
expect(provided1).toBeObservable(expected);
1811
});
1912

2013
it('from', () => {
21-
const provided1 = from(['a', 'b']);
22-
const expected = cold('(ab|)');
2314

24-
expect(provided1).toBeObservable(expected);
2515
});
2616

2717
it('should trim the spaces', () => {
28-
expect(cold(' ---a--b--c--| ')).toBeObservable(cold('---a--b--c--|'));
2918
});
3019
});

UM-Start/src/hot-cold/hot-value.spec.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ import { share } from 'rxjs/operators';
44

55
describe('hot', () => {
66
it('should create hot observable', () => {
7-
const given = from([1, 2, 3]).pipe(share());
8-
const expected = hot('(abc|)', { a: 1, b: 2, c: 3 });
9-
10-
expect(given).toBeObservable(expected);
7+
118
});
12-
9+
1310
});

UM-Start/src/hot-cold/hot.spec.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,12 @@ import { from } from 'rxjs';
33
import { share } from 'rxjs/operators';
44

55
describe('hot', () => {
6-
6+
77
it('should test subscription', () => {
8-
const source = hot('-a---^b---c---|');
9-
const subscription = ' ^--------!';
108

11-
expect(source).toHaveSubscriptions(subscription);
129
});
1310

1411
it('should test subscription observable', () => {
15-
const source = hot('-a-^(bc)-|');
16-
const expected = cold('-(bc)-|');
1712

18-
expect(source).toBeObservable(expected);
1913
});
2014
});

0 commit comments

Comments
 (0)