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
eb215b31
Commit
eb215b31
authored
Aug 04, 2020
by
jakeburden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use timezone data list fixture
Replace usage of mockTimezoneData with fixture
parent
3913f645
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
16 deletions
+16
-16
spec/frontend/deploy_freeze/components/deploy_freeze_modal_spec.js
...tend/deploy_freeze/components/deploy_freeze_modal_spec.js
+2
-2
spec/frontend/deploy_freeze/components/deploy_freeze_settings_spec.js
...d/deploy_freeze/components/deploy_freeze_settings_spec.js
+2
-3
spec/frontend/deploy_freeze/components/deploy_freeze_table_spec.js
...tend/deploy_freeze/components/deploy_freeze_table_spec.js
+2
-2
spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js
...ontend/deploy_freeze/components/timezone_dropdown_spec.js
+4
-4
spec/frontend/deploy_freeze/store/actions_spec.js
spec/frontend/deploy_freeze/store/actions_spec.js
+2
-2
spec/frontend/deploy_freeze/store/mutations_spec.js
spec/frontend/deploy_freeze/store/mutations_spec.js
+4
-3
No files found.
spec/frontend/deploy_freeze/components/deploy_freeze_modal_spec.js
View file @
eb215b31
...
@@ -4,7 +4,6 @@ import { GlButton, GlModal } from '@gitlab/ui';
...
@@ -4,7 +4,6 @@ import { GlButton, GlModal } from '@gitlab/ui';
import
DeployFreezeModal
from
'
~/deploy_freeze/components/deploy_freeze_modal.vue
'
;
import
DeployFreezeModal
from
'
~/deploy_freeze/components/deploy_freeze_modal.vue
'
;
import
TimezoneDropdown
from
'
~/vue_shared/components/timezone_dropdown.vue
'
;
import
TimezoneDropdown
from
'
~/vue_shared/components/timezone_dropdown.vue
'
;
import
createStore
from
'
~/deploy_freeze/store
'
;
import
createStore
from
'
~/deploy_freeze/store
'
;
import
{
mockTimezoneData
}
from
'
../mock_data
'
;
const
localVue
=
createLocalVue
();
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
...
@@ -13,11 +12,12 @@ describe('Deploy freeze modal', () => {
...
@@ -13,11 +12,12 @@ describe('Deploy freeze modal', () => {
let
wrapper
;
let
wrapper
;
let
store
;
let
store
;
const
freezePeriodsFixture
=
getJSONFixture
(
'
/api/freeze-periods/freeze-periods.json
'
);
const
freezePeriodsFixture
=
getJSONFixture
(
'
/api/freeze-periods/freeze-periods.json
'
);
const
timezoneDataFixture
=
getJSONFixture
(
'
/api/freeze-periods/timezone_data.json
'
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
store
=
createStore
({
store
=
createStore
({
projectId
:
'
8
'
,
projectId
:
'
8
'
,
timezoneData
:
mockTimezoneData
,
timezoneData
:
timezoneDataFixture
,
});
});
wrapper
=
shallowMount
(
DeployFreezeModal
,
{
wrapper
=
shallowMount
(
DeployFreezeModal
,
{
attachToDocument
:
true
,
attachToDocument
:
true
,
...
...
spec/frontend/deploy_freeze/components/deploy_freeze_settings_spec.js
View file @
eb215b31
...
@@ -3,9 +3,7 @@ import { createLocalVue, shallowMount } from '@vue/test-utils';
...
@@ -3,9 +3,7 @@ import { createLocalVue, shallowMount } from '@vue/test-utils';
import
DeployFreezeSettings
from
'
~/deploy_freeze/components/deploy_freeze_settings.vue
'
;
import
DeployFreezeSettings
from
'
~/deploy_freeze/components/deploy_freeze_settings.vue
'
;
import
DeployFreezeTable
from
'
~/deploy_freeze/components/deploy_freeze_table.vue
'
;
import
DeployFreezeTable
from
'
~/deploy_freeze/components/deploy_freeze_table.vue
'
;
import
DeployFreezeModal
from
'
~/deploy_freeze/components/deploy_freeze_modal.vue
'
;
import
DeployFreezeModal
from
'
~/deploy_freeze/components/deploy_freeze_modal.vue
'
;
import
createStore
from
'
~/deploy_freeze/store
'
;
import
createStore
from
'
~/deploy_freeze/store
'
;
import
{
mockTimezoneData
}
from
'
../mock_data
'
;
const
localVue
=
createLocalVue
();
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
...
@@ -13,11 +11,12 @@ localVue.use(Vuex);
...
@@ -13,11 +11,12 @@ localVue.use(Vuex);
describe
(
'
Deploy freeze settings
'
,
()
=>
{
describe
(
'
Deploy freeze settings
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
let
store
;
let
store
;
const
timezoneDataFixture
=
getJSONFixture
(
'
/api/freeze-periods/timezone_data.json
'
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
store
=
createStore
({
store
=
createStore
({
projectId
:
'
8
'
,
projectId
:
'
8
'
,
timezoneData
:
mockTimezoneData
,
timezoneData
:
timezoneDataFixture
,
});
});
jest
.
spyOn
(
store
,
'
dispatch
'
).
mockImplementation
();
jest
.
spyOn
(
store
,
'
dispatch
'
).
mockImplementation
();
wrapper
=
shallowMount
(
DeployFreezeSettings
,
{
wrapper
=
shallowMount
(
DeployFreezeSettings
,
{
...
...
spec/frontend/deploy_freeze/components/deploy_freeze_table_spec.js
View file @
eb215b31
...
@@ -2,7 +2,6 @@ import Vuex from 'vuex';
...
@@ -2,7 +2,6 @@ import Vuex from 'vuex';
import
{
createLocalVue
,
mount
}
from
'
@vue/test-utils
'
;
import
{
createLocalVue
,
mount
}
from
'
@vue/test-utils
'
;
import
DeployFreezeTable
from
'
~/deploy_freeze/components/deploy_freeze_table.vue
'
;
import
DeployFreezeTable
from
'
~/deploy_freeze/components/deploy_freeze_table.vue
'
;
import
createStore
from
'
~/deploy_freeze/store
'
;
import
createStore
from
'
~/deploy_freeze/store
'
;
import
{
mockTimezoneData
}
from
'
../mock_data
'
;
const
localVue
=
createLocalVue
();
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
...
@@ -10,11 +9,12 @@ localVue.use(Vuex);
...
@@ -10,11 +9,12 @@ localVue.use(Vuex);
describe
(
'
Deploy freeze table
'
,
()
=>
{
describe
(
'
Deploy freeze table
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
let
store
;
let
store
;
const
timezoneDataFixture
=
getJSONFixture
(
'
/api/freeze-periods/timezone_data.json
'
);
const
createComponent
=
()
=>
{
const
createComponent
=
()
=>
{
store
=
createStore
({
store
=
createStore
({
projectId
:
'
8
'
,
projectId
:
'
8
'
,
timezoneData
:
mockTimezoneData
,
timezoneData
:
timezoneDataFixture
,
});
});
jest
.
spyOn
(
store
,
'
dispatch
'
).
mockImplementation
();
jest
.
spyOn
(
store
,
'
dispatch
'
).
mockImplementation
();
wrapper
=
mount
(
DeployFreezeTable
,
{
wrapper
=
mount
(
DeployFreezeTable
,
{
...
...
spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js
View file @
eb215b31
...
@@ -2,7 +2,6 @@ import Vuex from 'vuex';
...
@@ -2,7 +2,6 @@ import Vuex from 'vuex';
import
TimezoneDropdown
from
'
~/vue_shared/components/timezone_dropdown.vue
'
;
import
TimezoneDropdown
from
'
~/vue_shared/components/timezone_dropdown.vue
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
createStore
from
'
~/deploy_freeze/store
'
;
import
createStore
from
'
~/deploy_freeze/store
'
;
import
{
mockTimezoneData
}
from
'
../mock_data
'
;
import
{
GlDeprecatedDropdownItem
,
GlNewDropdown
}
from
'
@gitlab/ui
'
;
import
{
GlDeprecatedDropdownItem
,
GlNewDropdown
}
from
'
@gitlab/ui
'
;
...
@@ -12,18 +11,19 @@ localVue.use(Vuex);
...
@@ -12,18 +11,19 @@ localVue.use(Vuex);
describe
(
'
Deploy freeze timezone dropdown
'
,
()
=>
{
describe
(
'
Deploy freeze timezone dropdown
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
let
store
;
let
store
;
const
timezoneDataFixture
=
getJSONFixture
(
'
/api/freeze-periods/timezone_data.json
'
);
const
createComponent
=
(
searchTerm
,
selectedTimezone
)
=>
{
const
createComponent
=
(
searchTerm
,
selectedTimezone
)
=>
{
store
=
createStore
({
store
=
createStore
({
projectId
:
'
8
'
,
projectId
:
'
8
'
,
timezoneData
:
mockTimezoneData
,
timezoneData
:
timezoneDataFixture
,
});
});
wrapper
=
shallowMount
(
TimezoneDropdown
,
{
wrapper
=
shallowMount
(
TimezoneDropdown
,
{
store
,
store
,
localVue
,
localVue
,
propsData
:
{
propsData
:
{
value
:
selectedTimezone
,
value
:
selectedTimezone
,
timezoneData
:
mockTimezoneData
,
timezoneData
:
timezoneDataFixture
,
},
},
});
});
...
@@ -54,7 +54,7 @@ describe('Deploy freeze timezone dropdown', () => {
...
@@ -54,7 +54,7 @@ describe('Deploy freeze timezone dropdown', () => {
});
});
it
(
'
renders all timezones when search term is empty
'
,
()
=>
{
it
(
'
renders all timezones when search term is empty
'
,
()
=>
{
expect
(
findAllDropdownItems
()).
toHaveLength
(
mockTimezoneData
.
length
);
expect
(
findAllDropdownItems
()).
toHaveLength
(
timezoneDataFixture
.
length
);
});
});
});
});
...
...
spec/frontend/deploy_freeze/store/actions_spec.js
View file @
eb215b31
...
@@ -6,7 +6,6 @@ import createFlash from '~/flash';
...
@@ -6,7 +6,6 @@ import createFlash from '~/flash';
import
getInitialState
from
'
~/deploy_freeze/store/state
'
;
import
getInitialState
from
'
~/deploy_freeze/store/state
'
;
import
*
as
actions
from
'
~/deploy_freeze/store/actions
'
;
import
*
as
actions
from
'
~/deploy_freeze/store/actions
'
;
import
*
as
types
from
'
~/deploy_freeze/store/mutation_types
'
;
import
*
as
types
from
'
~/deploy_freeze/store/mutation_types
'
;
import
{
mockTimezoneData
}
from
'
../mock_data
'
;
jest
.
mock
(
'
~/api.js
'
);
jest
.
mock
(
'
~/api.js
'
);
jest
.
mock
(
'
~/flash.js
'
);
jest
.
mock
(
'
~/flash.js
'
);
...
@@ -15,12 +14,13 @@ describe('deploy freeze store actions', () => {
...
@@ -15,12 +14,13 @@ describe('deploy freeze store actions', () => {
let
mock
;
let
mock
;
let
state
;
let
state
;
const
freezePeriodsFixture
=
getJSONFixture
(
'
/api/freeze-periods/freeze-periods.json
'
);
const
freezePeriodsFixture
=
getJSONFixture
(
'
/api/freeze-periods/freeze-periods.json
'
);
const
timezoneDataFixture
=
getJSONFixture
(
'
/api/freeze-periods/timezone_data.json
'
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
mock
=
new
MockAdapter
(
axios
);
state
=
getInitialState
({
state
=
getInitialState
({
projectId
:
'
8
'
,
projectId
:
'
8
'
,
timezoneData
:
mockTimezoneData
,
timezoneData
:
timezoneDataFixture
,
});
});
Api
.
freezePeriods
.
mockResolvedValue
({
data
:
freezePeriodsFixture
});
Api
.
freezePeriods
.
mockResolvedValue
({
data
:
freezePeriodsFixture
});
Api
.
createFreezePeriod
.
mockResolvedValue
();
Api
.
createFreezePeriod
.
mockResolvedValue
();
...
...
spec/frontend/deploy_freeze/store/mutations_spec.js
View file @
eb215b31
import
state
from
'
~/deploy_freeze/store/state
'
;
import
state
from
'
~/deploy_freeze/store/state
'
;
import
mutations
from
'
~/deploy_freeze/store/mutations
'
;
import
mutations
from
'
~/deploy_freeze/store/mutations
'
;
import
*
as
types
from
'
~/deploy_freeze/store/mutation_types
'
;
import
*
as
types
from
'
~/deploy_freeze/store/mutation_types
'
;
import
{
mockTimezoneData
}
from
'
../mock_data
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
describe
(
'
Deploy freeze mutations
'
,
()
=>
{
describe
(
'
Deploy freeze mutations
'
,
()
=>
{
let
stateCopy
;
let
stateCopy
;
const
timezoneDataFixture
=
getJSONFixture
(
'
/api/freeze-periods/timezone_data.json
'
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
stateCopy
=
state
({
stateCopy
=
state
({
projectId
:
'
8
'
,
projectId
:
'
8
'
,
timezoneData
:
mockTimezoneData
,
timezoneData
:
timezoneDataFixture
,
});
});
});
});
...
@@ -26,7 +27,7 @@ describe('Deploy freeze mutations', () => {
...
@@ -26,7 +27,7 @@ describe('Deploy freeze mutations', () => {
describe
(
'
RECEIVE_FREEZE_PERIODS_SUCCESS
'
,
()
=>
{
describe
(
'
RECEIVE_FREEZE_PERIODS_SUCCESS
'
,
()
=>
{
it
(
'
should set freeze periods and format timezones from identifiers to names
'
,
()
=>
{
it
(
'
should set freeze periods and format timezones from identifiers to names
'
,
()
=>
{
const
timezoneNames
=
[
'
Eastern Time (US & Canada)
'
,
'
UTC
'
,
'
Berlin
'
];
const
timezoneNames
=
[
'
Berlin
'
,
'
UTC
'
,
'
Eastern Time (US & Canada)
'
];
const
freezePeriodsFixture
=
getJSONFixture
(
'
/api/freeze-periods/freeze-periods.json
'
);
const
freezePeriodsFixture
=
getJSONFixture
(
'
/api/freeze-periods/freeze-periods.json
'
);
mutations
[
types
.
RECEIVE_FREEZE_PERIODS_SUCCESS
](
stateCopy
,
freezePeriodsFixture
);
mutations
[
types
.
RECEIVE_FREEZE_PERIODS_SUCCESS
](
stateCopy
,
freezePeriodsFixture
);
...
...
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