Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rex Dri
Rex Dri
Commits
9fc1fdda
Unverified
Commit
9fc1fdda
authored
May 17, 2020
by
Estelle Veisemburger
Committed by
Florent Chehab
May 24, 2020
Browse files
test: test new methods in majorMinorMappings utils
parent
d6cd8f9c
Changes
1
Hide whitespace changes
Inline
Side-by-side
frontend/src/utils/majorMinorMappings.test.js
View file @
9fc1fdda
import
{
getUpdatedMajor
,
getUpdatedMinor
}
from
"
./majorMinorMappings
"
;
import
{
getUpdatedMajor
,
getUpdatedMinor
,
getAllMajors
,
getAllMinors
,
getUpdatedUnivMajorMinors
,
}
from
"
./majorMinorMappings
"
;
test
(
"
GSM => IM
"
,
()
=>
{
const
major
=
"
GSM
"
;
...
...
@@ -15,8 +21,40 @@ test("GI => GI", () => {
expect
(
getUpdatedMajor
(
major
)).
toBe
(
"
GI
"
);
});
test
(
"
IM => IM, GM, GSM
"
,
()
=>
{
const
major
=
"
IM
"
;
expect
(
getAllMajors
(
major
).
sort
()).
toEqual
([
"
IM
"
,
"
GSM
"
,
"
GM
"
].
sort
());
});
test
(
"
GU => GU, GSU
"
,
()
=>
{
const
major
=
"
GU
"
;
expect
(
getAllMajors
(
major
).
sort
()).
toEqual
([
"
GU
"
,
"
GSU
"
].
sort
());
});
test
(
"
(_DUMMY_MAJOR_1, _DUMMY_MINOR_2) => _DUMMY_MINOR_1
"
,
()
=>
{
const
major
=
"
_DUMMY_MAJOR_1
"
;
const
minor
=
"
_DUMMY_MINOR_2
"
;
expect
(
getAllMinors
(
major
,
minor
).
sort
()).
toEqual
(
[
"
_DUMMY_MINOR_2
"
,
"
_DUMMY_MINOR_1
"
].
sort
()
);
});
test
(
"
BR - FIL => BR - FIL
"
,
()
=>
{
const
major
=
"
BR
"
;
const
minor
=
"
FIL
"
;
expect
(
getUpdatedMinor
(
major
,
minor
)).
toBe
(
"
FIL
"
);
});
test
(
"
univMajorMinors [] => []
"
,
()
=>
{
expect
(
getUpdatedUnivMajorMinors
([])).
toEqual
([]);
});
test
(
"
univMajorMinors dedup
"
,
()
=>
{
const
input
=
[
{
major
:
"
IM
"
,
minors
:
[
"
CMI
"
]
},
{
major
:
"
GSM
"
,
minors
:
[
"
CMI
"
]
},
{
major
:
"
GM
"
,
minors
:
[
"
MAT
"
]
},
];
const
output
=
[{
major
:
"
IM
"
,
minors
:
[
"
CMI
"
,
"
MAT
"
]
}];
expect
(
getUpdatedUnivMajorMinors
(
input
)).
toEqual
(
output
);
});
Write
Preview
Supports
Markdown
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