Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
05e61c36
Commit
05e61c36
authored
Dec 11, 2017
by
Eric Eastwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use shared interceptor in note specs
parent
9469979a
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
215 additions
and
205 deletions
+215
-205
spec/javascripts/notes/components/issue_note_app_spec.js
spec/javascripts/notes/components/issue_note_app_spec.js
+15
-31
spec/javascripts/notes/mock_data.js
spec/javascripts/notes/mock_data.js
+200
-174
No files found.
spec/javascripts/notes/components/issue_note_app_spec.js
View file @
05e61c36
...
@@ -8,28 +8,6 @@ describe('issue_note_app', () => {
...
@@ -8,28 +8,6 @@ describe('issue_note_app', () => {
let
mountComponent
;
let
mountComponent
;
let
vm
;
let
vm
;
const
individualNoteInterceptor
=
(
request
,
next
)
=>
{
next
(
request
.
respondWith
(
JSON
.
stringify
(
mockData
.
individualNoteServerResponse
),
{
status
:
200
,
}));
};
const
noteInterceptor
=
(
request
,
next
)
=>
{
if
(
request
.
url
===
'
/gitlab-org/gitlab-ce/issues/26/discussions.json
'
)
{
next
(
request
.
respondWith
(
JSON
.
stringify
(
mockData
.
discussionNoteServerResponse
),
{
status
:
200
,
}));
}
else
if
(
request
.
url
===
'
/gitlab-org/gitlab-ce/noteable/issue/98/notes
'
)
{
next
(
request
.
respondWith
(
JSON
.
stringify
(
mockData
.
notesPollingResponse
),
{
status
:
200
,
}));
}
else
if
(
request
.
method
===
'
PUT
'
&&
request
.
url
===
'
/gitlab-org/gitlab-ce/notes/1471
'
)
{
next
(
request
.
respondWith
(
JSON
.
stringify
(
mockData
.
updatedNoteResponse
),
{
status
:
200
,
}));
}
};
beforeEach
(()
=>
{
beforeEach
(()
=>
{
const
IssueNotesApp
=
Vue
.
extend
(
issueNotesApp
);
const
IssueNotesApp
=
Vue
.
extend
(
issueNotesApp
);
...
@@ -85,16 +63,16 @@ describe('issue_note_app', () => {
...
@@ -85,16 +63,16 @@ describe('issue_note_app', () => {
describe
(
'
render
'
,
()
=>
{
describe
(
'
render
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
Vue
.
http
.
interceptors
.
push
(
individualNoteInterceptor
);
Vue
.
http
.
interceptors
.
push
(
mockData
.
individualNoteInterceptor
);
vm
=
mountComponent
();
vm
=
mountComponent
();
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptors
,
individualNoteInterceptor
);
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptors
,
mockData
.
individualNoteInterceptor
);
});
});
it
(
'
should render list of notes
'
,
(
done
)
=>
{
it
(
'
should render list of notes
'
,
(
done
)
=>
{
const
note
=
mockData
.
individualNoteServerResponse
[
0
].
notes
[
0
];
const
note
=
mockData
.
INDIVIDUAL_NOTE_RESPONSE_MAP
.
GET
[
'
/gitlab-org/gitlab-ce/issues/26/discussions.json
'
]
[
0
].
notes
[
0
];
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
expect
(
...
@@ -140,13 +118,16 @@ describe('issue_note_app', () => {
...
@@ -140,13 +118,16 @@ describe('issue_note_app', () => {
describe
(
'
update note
'
,
()
=>
{
describe
(
'
update note
'
,
()
=>
{
describe
(
'
individual note
'
,
()
=>
{
describe
(
'
individual note
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
Vue
.
http
.
interceptors
.
push
(
n
oteInterceptor
);
Vue
.
http
.
interceptors
.
push
(
mockData
.
individualN
oteInterceptor
);
spyOn
(
service
,
'
updateNote
'
).
and
.
callThrough
();
spyOn
(
service
,
'
updateNote
'
).
and
.
callThrough
();
vm
=
mountComponent
();
vm
=
mountComponent
();
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptors
,
noteInterceptor
);
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptors
,
mockData
.
individualNoteInterceptor
,
);
});
});
it
(
'
renders edit form
'
,
(
done
)
=>
{
it
(
'
renders edit form
'
,
(
done
)
=>
{
...
@@ -180,13 +161,16 @@ describe('issue_note_app', () => {
...
@@ -180,13 +161,16 @@ describe('issue_note_app', () => {
describe
(
'
dicussion note
'
,
()
=>
{
describe
(
'
dicussion note
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
Vue
.
http
.
interceptors
.
push
(
n
oteInterceptor
);
Vue
.
http
.
interceptors
.
push
(
mockData
.
discussionN
oteInterceptor
);
spyOn
(
service
,
'
updateNote
'
).
and
.
callThrough
();
spyOn
(
service
,
'
updateNote
'
).
and
.
callThrough
();
vm
=
mountComponent
();
vm
=
mountComponent
();
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptors
,
noteInterceptor
);
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptors
,
mockData
.
discussionNoteInterceptor
,
);
});
});
it
(
'
renders edit form
'
,
(
done
)
=>
{
it
(
'
renders edit form
'
,
(
done
)
=>
{
...
@@ -237,12 +221,12 @@ describe('issue_note_app', () => {
...
@@ -237,12 +221,12 @@ describe('issue_note_app', () => {
describe
(
'
edit form
'
,
()
=>
{
describe
(
'
edit form
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
Vue
.
http
.
interceptors
.
push
(
individualNoteInterceptor
);
Vue
.
http
.
interceptors
.
push
(
mockData
.
individualNoteInterceptor
);
vm
=
mountComponent
();
vm
=
mountComponent
();
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptors
,
individualNoteInterceptor
);
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptors
,
mockData
.
individualNoteInterceptor
);
});
});
it
(
'
should render markdown docs url
'
,
(
done
)
=>
{
it
(
'
should render markdown docs url
'
,
(
done
)
=>
{
...
...
spec/javascripts/notes/mock_data.js
View file @
05e61c36
This diff is collapsed.
Click to expand it.
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