Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
4c66b9cb
Commit
4c66b9cb
authored
May 04, 2020
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve a few test descriptions per PR feedback
parent
764b1acf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
18 deletions
+21
-18
hypothesis-app-test.js
src/sidebar/components/test/hypothesis-app-test.js
+21
-18
No files found.
src/sidebar/components/test/hypothesis-app-test.js
View file @
4c66b9cb
...
...
@@ -138,24 +138,26 @@ describe('HypothesisApp', () => {
});
});
const
getAuthState
=
wrapper
=>
wrapper
.
find
(
'TopBar'
).
prop
(
'auth'
);
describe
(
'"status" field of "auth" prop passed to children'
,
()
=>
{
const
getStatus
=
wrapper
=>
wrapper
.
find
(
'TopBar'
).
prop
(
'auth'
).
status
;
it
(
'auth state
is "unknown" if profile has not yet been fetched'
,
()
=>
{
fakeStore
.
hasFetchedProfile
.
returns
(
false
);
const
wrapper
=
createComponent
();
assert
.
equal
(
getAuthState
(
wrapper
).
status
,
'unknown'
);
});
it
(
'
is "unknown" if profile has not yet been fetched'
,
()
=>
{
fakeStore
.
hasFetchedProfile
.
returns
(
false
);
const
wrapper
=
createComponent
();
assert
.
equal
(
getStatus
(
wrapper
)
,
'unknown'
);
});
it
(
'auth state
is "logged-out" if userid is null'
,
()
=>
{
fakeStore
.
profile
.
returns
({
userid
:
null
});
const
wrapper
=
createComponent
();
assert
.
equal
(
getAuthState
(
wrapper
).
status
,
'logged-out'
);
});
it
(
'
is "logged-out" if userid is null'
,
()
=>
{
fakeStore
.
profile
.
returns
({
userid
:
null
});
const
wrapper
=
createComponent
();
assert
.
equal
(
getStatus
(
wrapper
)
,
'logged-out'
);
});
it
(
'auth state is "logged-in" if userid is non-null'
,
()
=>
{
fakeStore
.
profile
.
returns
({
userid
:
'acct:jimsmith@hypothes.is'
});
const
wrapper
=
createComponent
();
assert
.
equal
(
getAuthState
(
wrapper
).
status
,
'logged-in'
);
it
(
'is "logged-in" if userid is non-null'
,
()
=>
{
fakeStore
.
profile
.
returns
({
userid
:
'acct:jimsmith@hypothes.is'
});
const
wrapper
=
createComponent
();
assert
.
equal
(
getStatus
(
wrapper
),
'logged-in'
);
});
});
[
...
...
@@ -192,10 +194,11 @@ describe('HypothesisApp', () => {
},
},
].
forEach
(({
profile
,
expectedAuth
})
=>
{
it
(
'
sets auth state depending on profile
'
,
()
=>
{
it
(
'
passes expected "auth" prop to children
'
,
()
=>
{
fakeStore
.
profile
.
returns
(
profile
);
const
wrapper
=
createComponent
();
assert
.
deepEqual
(
getAuthState
(
wrapper
),
expectedAuth
);
const
auth
=
wrapper
.
find
(
'TopBar'
).
prop
(
'auth'
);
assert
.
deepEqual
(
auth
,
expectedAuth
);
});
});
...
...
@@ -277,7 +280,7 @@ describe('HypothesisApp', () => {
assert
.
called
(
fakeToastMessenger
.
error
);
});
it
(
'sends LOGIN_REQUESTED
if a third-party service is in us
e'
,
async
()
=>
{
it
(
'sends LOGIN_REQUESTED
event to host page if using a third-party servic
e'
,
async
()
=>
{
// If the client is using a third-party annotation service then clicking
// on a login button should send the LOGIN_REQUESTED event over the bridge
// (so that the partner site we're embedded in can do its own login
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment