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
ffa32aa9
Commit
ffa32aa9
authored
Jul 26, 2023
by
Alejandro Celaya
Committed by
Alejandro Celaya
Jul 26, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expect AnnotationsExporter to receive the annotations list
parent
b488fafb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
12 deletions
+10
-12
annotations-exporter.ts
src/sidebar/services/annotations-exporter.ts
+9
-9
annotations-exporter-test.js
src/sidebar/services/test/annotations-exporter-test.js
+1
-3
No files found.
src/sidebar/services/annotations-exporter.ts
View file @
ffa32aa9
import
type
{
APIAnnotationData
}
from
'../../types/api'
;
import
type
{
A
nnotation
,
A
PIAnnotationData
}
from
'../../types/api'
;
import
{
stripInternalProperties
}
from
'../helpers/strip-internal-properties'
;
import
{
VersionData
}
from
'../helpers/version-data'
;
import
type
{
SidebarStore
}
from
'../store'
;
...
...
@@ -22,21 +22,21 @@ export class AnnotationsExporter {
this
.
_store
=
store
;
}
/**
* @param now - Test seam
*/
buildExportContent
(
now
=
new
Date
()):
ExportContent
{
buildExportContent
(
annotations
:
Annotation
[],
/* istanbul ignore next - test seam */
now
=
new
Date
()
):
ExportContent
{
const
profile
=
this
.
_store
.
profile
();
const
annotations
=
this
.
_store
.
allAnnotations
()
.
map
(
stripInternalProperties
)
as
APIAnnotationData
[];
const
versionData
=
new
VersionData
(
profile
,
[]);
return
{
export_date
:
now
.
toISOString
(),
export_userid
:
profile
.
userid
??
''
,
client_version
:
versionData
.
version
,
annotations
,
annotations
:
annotations
.
map
(
stripInternalProperties
)
as
APIAnnotationData
[],
};
}
}
src/sidebar/services/test/annotations-exporter-test.js
View file @
ffa32aa9
...
...
@@ -8,7 +8,6 @@ describe('AnnotationsExporter', () => {
beforeEach
(()
=>
{
fakeStore
=
{
profile
:
sinon
.
stub
().
returns
({
userid
:
'userId'
}),
allAnnotations
:
sinon
.
stub
(),
};
exporter
=
new
AnnotationsExporter
(
fakeStore
);
});
...
...
@@ -27,9 +26,8 @@ describe('AnnotationsExporter', () => {
$highlight
:
true
,
},
];
fakeStore
.
allAnnotations
.
returns
(
annotations
);
const
result
=
exporter
.
buildExportContent
(
now
);
const
result
=
exporter
.
buildExportContent
(
annotations
,
now
);
assert
.
deepEqual
(
result
,
{
export_date
:
now
.
toISOString
(),
...
...
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