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
24b98a87
Commit
24b98a87
authored
Jan 16, 2019
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added specs for mutations & utils methods
parent
9ff20ad7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
141 additions
and
0 deletions
+141
-0
spec/javascripts/diffs/store/mutations_spec.js
spec/javascripts/diffs/store/mutations_spec.js
+22
-0
spec/javascripts/diffs/store/utils_spec.js
spec/javascripts/diffs/store/utils_spec.js
+119
-0
No files found.
spec/javascripts/diffs/store/mutations_spec.js
View file @
24b98a87
...
@@ -628,4 +628,26 @@ describe('DiffsStoreMutations', () => {
...
@@ -628,4 +628,26 @@ describe('DiffsStoreMutations', () => {
expect
(
file
.
parallel_diff_lines
[
1
].
right
.
hasForm
).
toBe
(
false
);
expect
(
file
.
parallel_diff_lines
[
1
].
right
.
hasForm
).
toBe
(
false
);
});
});
});
});
describe
(
'
SET_TREE_DATA
'
,
()
=>
{
it
(
'
sets treeEntries and tree in state
'
,
()
=>
{
const
state
=
{
treeEntries
:
{},
tree
:
[],
};
mutations
[
types
.
SET_TREE_DATA
](
state
,
{
treeEntries
:
{
file
:
{
name
:
'
index.js
'
}
},
tree
:
[
'
tree
'
],
});
expect
(
state
.
treeEntries
).
toEqual
({
file
:
{
name
:
'
index.js
'
,
},
});
expect
(
state
.
tree
).
toEqual
([
'
tree
'
]);
});
});
});
});
spec/javascripts/diffs/store/utils_spec.js
View file @
24b98a87
...
@@ -601,4 +601,123 @@ describe('DiffsStoreUtils', () => {
...
@@ -601,4 +601,123 @@ describe('DiffsStoreUtils', () => {
expect
(
utils
.
getDiffMode
({})).
toBe
(
'
replaced
'
);
expect
(
utils
.
getDiffMode
({})).
toBe
(
'
replaced
'
);
});
});
});
});
describe
(
'
getLowestSingleFolder
'
,
()
=>
{
it
(
'
returns path and tree of lowest single folder tree
'
,
()
=>
{
const
folder
=
{
name
:
'
app
'
,
type
:
'
tree
'
,
tree
:
[
{
name
:
'
javascripts
'
,
type
:
'
tree
'
,
tree
:
[
{
type
:
'
blob
'
,
name
:
'
index.js
'
,
},
],
},
],
};
const
{
path
,
treeAcc
}
=
utils
.
getLowestSingleFolder
(
folder
);
expect
(
path
).
toEqual
(
'
app/javascripts
'
);
expect
(
treeAcc
).
toEqual
([
{
type
:
'
blob
'
,
name
:
'
index.js
'
,
},
]);
});
it
(
'
returns passed in folders path & tree when more than tree exists
'
,
()
=>
{
const
folder
=
{
name
:
'
app
'
,
type
:
'
tree
'
,
tree
:
[
{
name
:
'
spec
'
,
type
:
'
blob
'
,
tree
:
[],
},
],
};
const
{
path
,
treeAcc
}
=
utils
.
getLowestSingleFolder
(
folder
);
expect
(
path
).
toEqual
(
'
app
'
);
expect
(
treeAcc
).
toBeNull
();
});
});
describe
(
'
flattenTree
'
,
()
=>
{
it
(
'
returns flattened directory structure
'
,
()
=>
{
const
tree
=
[
{
type
:
'
tree
'
,
name
:
'
app
'
,
tree
:
[
{
type
:
'
tree
'
,
name
:
'
javascripts
'
,
tree
:
[
{
type
:
'
blob
'
,
name
:
'
index.js
'
,
tree
:
[],
},
],
},
],
},
{
type
:
'
tree
'
,
name
:
'
spec
'
,
tree
:
[
{
type
:
'
tree
'
,
name
:
'
javascripts
'
,
tree
:
[],
},
{
type
:
'
blob
'
,
name
:
'
index_spec.js
'
,
tree
:
[],
},
],
},
];
const
flattened
=
utils
.
flattenTree
(
tree
);
expect
(
flattened
).
toEqual
([
{
type
:
'
tree
'
,
name
:
'
app/javascripts
'
,
tree
:
[
{
type
:
'
blob
'
,
name
:
'
index.js
'
,
tree
:
[],
},
],
},
{
type
:
'
tree
'
,
name
:
'
spec
'
,
tree
:
[
{
type
:
'
tree
'
,
name
:
'
javascripts
'
,
tree
:
[],
},
{
type
:
'
blob
'
,
name
:
'
index_spec.js
'
,
tree
:
[],
},
],
},
]);
});
});
});
});
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