Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Commits on Source (2)
(fix): issue with social profiles
· 16dccc25
Marcelo Rivera
authored
Sep 17, 2019
16dccc25
(fix): spec tests
· 8ee8ba1b
Marcelo Rivera
authored
Sep 17, 2019
8ee8ba1b
Hide whitespace changes
Inline
Side-by-side
src/app/modules/auth/login.component.spec.ts
View file @
8ee8ba1b
...
...
@@ -115,7 +115,7 @@ describe('LoginComponent', () => {
);
expect
(
h3
).
not
.
toBeNull
();
expect
(
h3
.
nativeElement
.
textContent
).
toContain
(
'
Not on Minds? Start a channel
'
'
Not on Minds? Start a
Minds
channel
'
);
expect
(
fixture
.
debugElement
.
query
(
By
.
css
(
'
minds-form-register
'
))
...
...
src/app/modules/channels/sidebar/sidebar.spec.ts
View file @
8ee8ba1b
...
...
@@ -106,6 +106,11 @@ describe('ChannelSidebar', () => {
selector
:
'
m-channel-mode-selector
'
,
inputs
:
[
'
user
'
,
'
enabled
'
],
}),
MockComponent
({
selector
:
'
m-tooltip
'
,
template
:
'
<ng-content></ng-content>
'
,
inputs
:
[
'
icon
'
,
'
iconClass
'
],
}),
IfFeatureDirective
,
],
imports
:
[
FormsModule
,
RouterTestingModule
,
NgCommonModule
],
...
...
@@ -140,6 +145,7 @@ describe('ChannelSidebar', () => {
fixture
=
TestBed
.
createComponent
(
ChannelSidebar
);
featuresServiceMock
.
mock
(
'
es-feeds
'
,
false
);
featuresServiceMock
.
mock
(
'
permissions
'
,
true
);
featuresServiceMock
.
mock
(
'
pro
'
,
true
);
clientMock
.
response
=
{};
uploadMock
.
response
=
{};
comp
=
fixture
.
componentInstance
;
...
...
src/app/modules/channels/social-profiles/meta.ts
View file @
8ee8ba1b
...
...
@@ -220,9 +220,9 @@ export function getSocialProfileMeta(key: string): SocialProfileMeta {
return
defaultMeta
;
}
for
(
let
i
in
this
.
socialProfile
s
Meta
)
{
if
(
this
.
socialProfile
s
Meta
[
i
].
key
===
key
)
{
return
this
.
socialProfile
s
Meta
[
i
];
for
(
let
i
in
socialProfileMeta
)
{
if
(
socialProfileMeta
[
i
].
key
===
key
)
{
return
socialProfileMeta
[
i
];
}
}
...
...
src/app/modules/forms/login/login.spec.ts
View file @
8ee8ba1b
...
...
@@ -28,9 +28,6 @@ describe('LoginForm', () => {
let
loginButton
:
DebugElement
;
let
errorMessage
:
DebugElement
;
let
twoFactorForm
:
DebugElement
;
let
twoFactorCode
:
DebugElement
;
let
twoFactorLoginButton
:
DebugElement
;
let
session
:
Session
;
function
login
(
response
,
_username
=
'
username
'
)
{
...
...
@@ -52,6 +49,7 @@ describe('LoginForm', () => {
}
function
twoFactorLogin
(
response
)
{
const
twoFactorCode
=
getTwoFactorCode
();
twoFactorCode
.
nativeElement
.
value
=
'
123123
'
;
twoFactorCode
.
nativeElement
.
dispatchEvent
(
new
Event
(
'
input
'
));
...
...
@@ -62,12 +60,24 @@ describe('LoginForm', () => {
tick
();
fixture
.
detectChanges
();
t
woFactorLoginButton
.
nativeElement
.
click
();
getT
woFactorLoginButton
()
.
nativeElement
.
click
();
tick
();
fixture
.
detectChanges
();
}
function
getTwoFactorForm
()
{
return
fixture
.
debugElement
.
query
(
By
.
css
(
'
.minds-login-box:last-of-type
'
));
}
function
getTwoFactorCode
()
{
return
fixture
.
debugElement
.
query
(
By
.
css
(
'
#code
'
));
}
function
getTwoFactorLoginButton
()
{
return
fixture
.
debugElement
.
query
(
By
.
css
(
'
.mdl-card > button
'
));
}
beforeEach
(
async
(()
=>
{
TestBed
.
configureTestingModule
({
declarations
:
[
...
...
@@ -95,13 +105,6 @@ describe('LoginForm', () => {
password
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
#password
'
));
loginButton
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
.m-btn--login
'
));
errorMessage
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
.m-error-box
'
));
twoFactorForm
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
.minds-login-box:last-of-type
'
)
);
twoFactorCode
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
#code
'
));
twoFactorLoginButton
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
.mdl-card > button
'
)
);
session
=
comp
.
session
;
...
...
@@ -244,7 +247,8 @@ describe('LoginForm', () => {
login
({
status
:
'
error
'
,
code
:
'
403
'
,
message
:
'
imaprettymessage
'
});
expect
(
loginForm
.
nativeElement
.
hidden
).
toBeTruthy
();
expect
(
twoFactorForm
.
nativeElement
.
hidden
).
toBeFalsy
();
expect
(
getTwoFactorForm
().
nativeElement
.
hidden
).
toBeFalsy
();
}));
it
(
'
should spawn error message when incorrect code is written
'
,
fakeAsync
(()
=>
{
...
...
src/app/modules/newsfeed/newsfeed.component.spec.ts
View file @
8ee8ba1b
...
...
@@ -122,6 +122,7 @@ describe('NewsfeedComponent', () => {
clientMock
.
response
=
{};
featuresServiceMock
.
mock
(
'
top-feeds
'
,
false
);
featuresServiceMock
.
mock
(
'
suggested-users
'
,
false
);
featuresServiceMock
.
mock
(
'
pro
'
,
false
);
sessionMock
.
user
.
admin
=
false
;
sessionMock
.
loggedIn
=
true
;
...
...
src/app/modules/notifications/notification.component.spec.ts
View file @
8ee8ba1b
...
...
@@ -23,7 +23,7 @@ import { sessionMock } from '../../../tests/session-mock.spec';
import
{
ExcerptPipe
}
from
'
../../common/pipes/excerpt
'
;
describe
(
'
Notification
s
Component
'
,
()
=>
{
describe
(
'
NotificationComponent
'
,
()
=>
{
let
comp
:
NotificationComponent
;
let
fixture
:
ComponentFixture
<
NotificationComponent
>
;
...
...
@@ -248,7 +248,7 @@ describe('NotificationsComponent', () => {
fixture
.
detectChanges
();
expect
(
comp
.
notification
).
not
.
toBeNull
();
const
notification
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
p
'
));
expect
(
notification
.
nativeElement
.
innerHTML
).
to
Be
(
expect
(
notification
.
nativeElement
.
innerHTML
).
to
Contain
(
'
name tagged you in a post
'
);
});
...
...
@@ -276,7 +276,7 @@ describe('NotificationsComponent', () => {
fixture
.
detectChanges
();
expect
(
comp
.
notification
).
not
.
toBeNull
();
const
notification
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
p
'
));
expect
(
notification
.
nativeElement
.
innerHTML
).
to
Be
(
expect
(
notification
.
nativeElement
.
innerHTML
).
to
Contain
(
'
name tagged you in a comment
'
);
});
...
...
@@ -518,7 +518,7 @@ describe('NotificationsComponent', () => {
fixture
.
detectChanges
();
expect
(
comp
.
notification
).
not
.
toBeNull
();
const
notification
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
p
'
));
expect
(
notification
.
nativeElement
.
innerHTML
).
to
Be
(
expect
(
notification
.
nativeElement
.
innerHTML
).
to
Contain
(
'
You can gain more reach by boosting your content. Hit the blue boost icon on your posts.
'
);
});
...
...
src/app/modules/notifications/notification.service.spec.ts
View file @
8ee8ba1b
...
...
@@ -3,7 +3,17 @@ import { clientMock } from '../../../tests/client-mock.spec';
import
{
sessionMock
}
from
'
../../../tests/session-mock.spec
'
;
import
{
socketMock
}
from
'
../../../tests/socket-mock.spec
'
;
import
{
fakeAsync
,
tick
}
from
'
@angular/core/testing
'
;
import
{
mindsTitleMock
}
from
'
../../../app/mocks/services/ux/minds-title.service.mock.spec
'
;
import
{
mindsTitleMock
}
from
'
../../mocks/services/ux/minds-title.service.mock.spec
'
;
import
{
MockService
}
from
'
../../utils/mock
'
;
import
{
SiteService
}
from
'
../../services/site.service
'
;
import
{
EventEmitter
}
from
'
@angular/core
'
;
export
let
siteServiceMock
=
new
(
function
()
{
var
pro
=
()
=>
null
;
var
isProDomain
=
()
=>
false
;
var
title
=
()
=>
'
Minds
'
;
var
isAdmin
=
()
=>
true
;
})();
describe
(
'
NewsfeedService
'
,
()
=>
{
let
service
:
NotificationService
;
...
...
@@ -12,10 +22,11 @@ describe('NewsfeedService', () => {
jasmine
.
clock
().
uninstall
();
jasmine
.
clock
().
install
();
service
=
new
NotificationService
(
clientMock
,
sessionMock
,
clientMock
,
socketMock
,
mindsTitleMock
mindsTitleMock
,
siteServiceMock
);
clientMock
.
response
=
{};
});
...
...