Skip to content

Commit 767ccd0

Browse files
author
Arthur Ayvazov
committed
geophystech#137 Users component tests.
1 parent f9d8c3b commit 767ccd0

13 files changed

+133
-11
lines changed

src/App.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
.catch(error => { console.log(error) })
5858
},
5959
fetchSystemInfo: function() {
60-
this.$http.get(this.$root.$options.settings.api.endpointSystemInfo)
60+
this.$http.get(appSettings.endpointSystemInfo)
6161
.then(response => {
6262
(data => {
6363
this.$store.dispatch('setMsk64ConfigVersion', data.msk64Config.data.config_version)

src/components/CountersHeader.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
<script>
3737
import ModalMap from '@/components/maps/ModalMap'
3838
import ExportDropDown from '@/components/ExportDropDown'
39+
import apiSettings from '@/settings/api'
40+
3941
export default {
4042
props: {
4143
trainingEventsBtnDisabled: false,
@@ -56,7 +58,7 @@
5658
methods: {
5759
export2xls: function(request) {
5860
let params = Object.assign({}, this.filtersData)
59-
request(this.$root.$options.settings.api.endpointEvents, Object.assign(params, {
61+
request(apiSettings.endpointEvents, Object.assign(params, {
6062
limit: 5000
6163
}))
6264
},

src/components/event/Header.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
import Spinner from '@/components/Spinner'
6464
import ExportDropDown from '@/components/ExportDropDown'
6565
import { agency, agencyDescription } from '@/helpers/event'
66+
import apiSettings from '@/settings/api'
6667
6768
export default {
6869
components: { Spinner, ExportDropDown },
@@ -105,7 +106,7 @@
105106
}
106107
},
107108
export2xls: function(request) {
108-
request(this.$root.$options.settings.api.endpointEvent(this.event.id))
109+
request(apiSettings.endpointEvent(this.event.id))
109110
}
110111
},
111112
computed: {

src/components/maps/GeneralInformation.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<script>
66
import { addEpicenter, createMap, id, removeEpicenter, setView } from '@/map_functions'
77
import { numberDeclension } from '@/helpers/number'
8+
import apiSettings from '@/settings/api'
89
910
export default {
1011
props: ['event', 'tab'],
@@ -93,7 +94,7 @@
9394
return this.putEpicenter()
9495
}
9596
96-
this.$http.get(this.$root.$options.settings.api.endpointEventPga(this.event.id))
97+
this.$http.get(apiSettings.endpointEventPga(this.event.id))
9798
.then(response => {
9899
this.addData(response.data.data)
99100
})

src/components/users/ConfirmPassword.vue

+8-2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
</template>
5252

5353
<script>
54+
import apiSettings from '@/settings/api'
55+
5456
export default {
5557
data() {
5658
return {
@@ -66,7 +68,11 @@
6668
email: null,
6769
form: {
6870
fields: {
69-
password: { value: '', disabled: false, state: null }
71+
password: {
72+
value: '',
73+
disabled: false,
74+
state: null
75+
}
7076
},
7177
messages: {
7278
password: 'Некорректный пароль'
@@ -107,7 +113,7 @@
107113
108114
this.disableFields()
109115
110-
this.$http.post(this.$root.$options.settings.api.endpointUserResetPasswordComplete, payload)
116+
this.$http.post(apiSettings.endpointUserResetPasswordComplete, payload)
111117
.then(response => {
112118
this.passwordChanged = true
113119
})

src/components/users/Confirmation.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
</template>
2121

2222
<script>
23+
import apiSettings from '@/settings/api'
24+
2325
export default {
2426
data() {
2527
return {
@@ -44,7 +46,7 @@
4446
},
4547
methods: {
4648
confirmEmail: function(token) {
47-
this.$http.post(this.$root.$options.settings.api.endpointEmailConfirmation(token))
49+
this.$http.post(apiSettings.endpointEmailConfirmation(token))
4850
.then(response => {
4951
this.status = 'success'
5052
this.message = response.data.data

src/components/users/Registration.vue

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<b-row v-if="registrationComplete">
1010
<b-col class="complete" cols="8" offset="2" align="center">
1111
<h5>Регистрация завершена</h5>
12-
<p>На указанный электронный адрес отправлено письмо. </p>
12+
<p>На указанный электронный адрес отправлено письмо.</p>
1313
<p>Вам осталось только открыть это письмо и нажать на кнопку "Подтвердить регистрацию".</p>
1414
</b-col>
1515
</b-row>
@@ -123,6 +123,8 @@
123123
</template>
124124

125125
<script>
126+
import apiSettings from '@/settings/api'
127+
126128
export default {
127129
data() {
128130
return {
@@ -184,7 +186,7 @@
184186
this.changeFieldsDisabledState(true)
185187
},
186188
getPurposesList: function() {
187-
this.$http.get(this.$root.$options.settings.api.endpointPurposesList)
189+
this.$http.get(apiSettings.endpointPurposesList)
188190
.then(response => {
189191
Object.keys(response.data.data).forEach(key => {
190192
this.form.purposes.values.push({ value: key, text: response.data.data[key] })
@@ -211,7 +213,7 @@
211213
212214
this.disableFields()
213215
214-
this.$http.post(this.$root.$options.settings.api.endpointUserRegistration, payload)
216+
this.$http.post(apiSettings.endpointUserRegistration, payload)
215217
.then(response => {
216218
this.registrationComplete = true
217219
})

src/components/users/ResetPassword.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
</template>
4848

4949
<script>
50+
import apiSettings from '@/settings/api'
51+
5052
export default {
5153
data() {
5254
return {
@@ -101,7 +103,7 @@
101103
102104
this.disableFields()
103105
104-
this.$http.post(this.$root.$options.settings.api.endpointUserResetPassword, payload)
106+
this.$http.post(apiSettings.endpointUserResetPassword, payload)
105107
.then(response => {
106108
this.resetComplete = true
107109
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { shallowMount } from '@vue/test-utils'
2+
import Authentication from '@/components/users/Authentication'
3+
import {$routerMocks} from '../../utils'
4+
import $moment from 'moment'
5+
import $http from 'axios'
6+
7+
describe('users/Authentication.vue', () => {
8+
9+
const wrapper = shallowMount(Authentication, {
10+
mocks: Object.assign({ $http, $moment }, $routerMocks),
11+
propsData: {
12+
form: {
13+
14+
}
15+
}
16+
})
17+
18+
it('Check component Authentication', () => {
19+
expect(wrapper.is(Authentication)).to.eql(true)
20+
})
21+
22+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { shallowMount } from '@vue/test-utils'
2+
import ConfirmPassword from '@/components/users/ConfirmPassword'
3+
import {$routerMocks} from '../../utils'
4+
import $moment from 'moment'
5+
import $http from 'axios'
6+
7+
describe('users/ConfirmPassword.vue', () => {
8+
9+
const wrapper = shallowMount(ConfirmPassword, {
10+
mocks: Object.assign({ $http, $moment }, $routerMocks),
11+
propsData: {
12+
form: {
13+
14+
}
15+
}
16+
})
17+
18+
it('Check component ConfirmPassword', () => {
19+
expect(wrapper.is(ConfirmPassword)).to.eql(true)
20+
})
21+
22+
})
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { shallowMount } from '@vue/test-utils'
2+
import Confirmation from '@/components/users/Confirmation'
3+
import {$routerMocks} from '../../utils'
4+
import $moment from 'moment'
5+
import $http from 'axios'
6+
7+
describe('users/Confirmation.vue', () => {
8+
9+
const wrapper = shallowMount(Confirmation, {
10+
mocks: Object.assign({ $http, $moment }, $routerMocks),
11+
propsData: {}
12+
})
13+
14+
it('Check component Confirmation', () => {
15+
expect(wrapper.is(Confirmation)).to.eql(true)
16+
})
17+
18+
})
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { shallowMount } from '@vue/test-utils'
2+
import Registration from '@/components/users/Registration'
3+
import {$routerMocks} from '../../utils'
4+
import $moment from 'moment'
5+
import $http from 'axios'
6+
7+
describe('users/Registration.vue', () => {
8+
9+
const wrapper = shallowMount(Registration, {
10+
mocks: Object.assign({ $http, $moment }, $routerMocks),
11+
propsData: {
12+
form: {
13+
14+
}
15+
}
16+
})
17+
18+
it('Check component Registration', () => {
19+
expect(wrapper.is(Registration)).to.eql(true)
20+
})
21+
22+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { shallowMount } from '@vue/test-utils'
2+
import ResetPassword from '@/components/users/ResetPassword'
3+
import {$routerMocks} from '../../utils'
4+
import $moment from 'moment'
5+
import $http from 'axios'
6+
7+
describe('users/ResetPassword.vue', () => {
8+
9+
const wrapper = shallowMount(ResetPassword, {
10+
mocks: Object.assign({ $http, $moment }, $routerMocks),
11+
propsData: {
12+
form: {
13+
14+
}
15+
}
16+
})
17+
18+
it('Check component ResetPassword', () => {
19+
expect(wrapper.is(ResetPassword)).to.eql(true)
20+
})
21+
22+
})

0 commit comments

Comments
 (0)