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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
cf26f27d
Commit
cf26f27d
authored
Nov 30, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated diff spec
parent
386cbf22
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
31 deletions
+31
-31
spec/javascripts/repo/lib/diff/diff_spec.js
spec/javascripts/repo/lib/diff/diff_spec.js
+31
-31
No files found.
spec/javascripts/repo/lib/diff/diff_spec.js
View file @
cf26f27d
...
...
@@ -10,71 +10,71 @@ describe('Multi-file editor library diff calculator', () => {
describe
(
'
modified
'
,
()
=>
{
it
(
''
,
()
=>
{
const
diff
=
computeDiff
(
'
123
'
,
'
1234
'
);
const
diff
=
computeDiff
(
'
123
'
,
'
1234
'
)
[
0
]
;
expect
(
diff
[
0
]
.
added
).
toBeTruthy
();
expect
(
diff
[
0
]
.
modified
).
toBeTruthy
();
expect
(
diff
[
0
]
.
removed
).
toBeUndefined
();
expect
(
diff
.
added
).
toBeTruthy
();
expect
(
diff
.
modified
).
toBeTruthy
();
expect
(
diff
.
removed
).
toBeUndefined
();
});
it
(
''
,
()
=>
{
const
diff
=
computeDiff
(
'
123
\n
123
\n
123
'
,
'
123
\n
1234
\n
123
'
);
const
diff
=
computeDiff
(
'
123
\n
123
\n
123
'
,
'
123
\n
1234
\n
123
'
)
[
0
]
;
expect
(
diff
[
0
]
.
added
).
toBeTruthy
();
expect
(
diff
[
0
]
.
modified
).
toBeTruthy
();
expect
(
diff
[
0
]
.
removed
).
toBeUndefined
();
expect
(
diff
[
0
]
.
lineNumber
).
toBe
(
2
);
expect
(
diff
.
added
).
toBeTruthy
();
expect
(
diff
.
modified
).
toBeTruthy
();
expect
(
diff
.
removed
).
toBeUndefined
();
expect
(
diff
.
lineNumber
).
toBe
(
2
);
});
});
describe
(
'
added
'
,
()
=>
{
it
(
''
,
()
=>
{
const
diff
=
computeDiff
(
'
123
'
,
'
123
\n
123
'
);
const
diff
=
computeDiff
(
'
123
'
,
'
123
\n
123
'
)
[
0
]
;
expect
(
diff
[
0
]
.
added
).
toBeTruthy
();
expect
(
diff
[
0
]
.
modified
).
toBeUndefined
();
expect
(
diff
[
0
]
.
removed
).
toBeUndefined
();
expect
(
diff
.
added
).
toBeTruthy
();
expect
(
diff
.
modified
).
toBeUndefined
();
expect
(
diff
.
removed
).
toBeUndefined
();
});
it
(
''
,
()
=>
{
const
diff
=
computeDiff
(
'
123
\n
123
\n
123
'
,
'
123
\n
123
\n
1234
\n
123
'
);
const
diff
=
computeDiff
(
'
123
\n
123
\n
123
'
,
'
123
\n
123
\n
1234
\n
123
'
)
[
0
]
;
expect
(
diff
[
0
]
.
added
).
toBeTruthy
();
expect
(
diff
[
0
]
.
modified
).
toBeUndefined
();
expect
(
diff
[
0
]
.
removed
).
toBeUndefined
();
expect
(
diff
[
0
]
.
lineNumber
).
toBe
(
3
);
expect
(
diff
.
added
).
toBeTruthy
();
expect
(
diff
.
modified
).
toBeUndefined
();
expect
(
diff
.
removed
).
toBeUndefined
();
expect
(
diff
.
lineNumber
).
toBe
(
3
);
});
});
describe
(
'
removed
'
,
()
=>
{
it
(
''
,
()
=>
{
const
diff
=
computeDiff
(
'
123
'
,
''
);
const
diff
=
computeDiff
(
'
123
'
,
''
)
[
0
]
;
expect
(
diff
[
0
]
.
added
).
toBeUndefined
();
expect
(
diff
[
0
]
.
modified
).
toBeUndefined
();
expect
(
diff
[
0
]
.
removed
).
toBeTruthy
();
expect
(
diff
.
added
).
toBeUndefined
();
expect
(
diff
.
modified
).
toBeUndefined
();
expect
(
diff
.
removed
).
toBeTruthy
();
});
it
(
''
,
()
=>
{
const
diff
=
computeDiff
(
'
123
\n
123
\n
123
'
,
'
123
\n
123
'
);
const
diff
=
computeDiff
(
'
123
\n
123
\n
123
'
,
'
123
\n
123
'
)
[
0
]
;
expect
(
diff
[
0
]
.
added
).
toBeUndefined
();
expect
(
diff
[
0
]
.
modified
).
toBeTruthy
();
expect
(
diff
[
0
]
.
removed
).
toBeTruthy
();
expect
(
diff
[
0
]
.
lineNumber
).
toBe
(
2
);
expect
(
diff
.
added
).
toBeUndefined
();
expect
(
diff
.
modified
).
toBeTruthy
();
expect
(
diff
.
removed
).
toBeTruthy
();
expect
(
diff
.
lineNumber
).
toBe
(
2
);
});
});
it
(
'
includes line number of change
'
,
()
=>
{
const
diff
=
computeDiff
(
'
123
'
,
''
);
const
diff
=
computeDiff
(
'
123
'
,
''
)
[
0
]
;
expect
(
diff
[
0
]
.
lineNumber
).
toBe
(
1
);
expect
(
diff
.
lineNumber
).
toBe
(
1
);
});
it
(
'
includes end line number of change
'
,
()
=>
{
const
diff
=
computeDiff
(
'
123
'
,
''
);
const
diff
=
computeDiff
(
'
123
'
,
''
)
[
0
]
;
expect
(
diff
[
0
]
.
endLineNumber
).
toBe
(
1
);
expect
(
diff
.
endLineNumber
).
toBe
(
1
);
});
});
});
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