feat(tests): refactor
This commit is contained in:
parent
f6ca446f92
commit
49626cb681
@ -27,4 +27,4 @@ ifeq ($(commit),)
|
|||||||
$(error mn is not set)
|
$(error mn is not set)
|
||||||
endif
|
endif
|
||||||
make prehook
|
make prehook
|
||||||
git add . && git commit -m "feat($(commit)):" && git push
|
git add . && git commit -m "$(commit)" && git push
|
||||||
|
|||||||
8
live_monitor_vue/src/adapters/AdapterOfPacks.js
Normal file
8
live_monitor_vue/src/adapters/AdapterOfPacks.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
class AdapterOfPacks {
|
||||||
|
constructor(url) {
|
||||||
|
this.url = url
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AdapterOfPacks
|
||||||
@ -1,109 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="flex border-8 w-1/2 flex-col py-1 gap-y-5">
|
|
||||||
<div class="flex flex-row gap-y-5 w-full justify-between">
|
|
||||||
<fwb-p
|
|
||||||
v-if="!isEdit"
|
|
||||||
class="self-center px-5"
|
|
||||||
>
|
|
||||||
{{ label }}
|
|
||||||
</fwb-p>
|
|
||||||
<div
|
|
||||||
class="flex flex-row gap-x-5 justify-between"
|
|
||||||
:class="{'w-full': isEdit}"
|
|
||||||
>
|
|
||||||
<fwb-input
|
|
||||||
v-if="isEdit"
|
|
||||||
class="w-full"
|
|
||||||
:model-value="realLink"
|
|
||||||
@update:model-value="args => {tempLink = args}"
|
|
||||||
/>
|
|
||||||
<ButtonEdit
|
|
||||||
v-if="!isEdit"
|
|
||||||
:on-click="() => {isEdit = true}"
|
|
||||||
/>
|
|
||||||
<ButtonSave
|
|
||||||
v-if="isEdit"
|
|
||||||
:on-click="() => {clickSave()}"
|
|
||||||
/>
|
|
||||||
<ButtonDiscard
|
|
||||||
v-if="isEdit"
|
|
||||||
:on-click="() => {clickDiscard()}"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<YouTube
|
|
||||||
v-if="isLinkNormal && isReady"
|
|
||||||
ref="youtube"
|
|
||||||
:src="realLink"
|
|
||||||
width="100%"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import ButtonSave from "@atoms/ButtonSave.vue";
|
|
||||||
import YouTube from "vue3-youtube";
|
|
||||||
import ButtonEdit from "@atoms/ButtonEdit.vue";
|
|
||||||
import ButtonDiscard from "@atoms/ButtonDiscard.vue";
|
|
||||||
import {FwbInput, FwbP} from "flowbite-vue";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
FwbInput,
|
|
||||||
FwbP,
|
|
||||||
YouTube, ButtonDiscard, ButtonSave, ButtonEdit
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
videoLink: {
|
|
||||||
type: String,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
label: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
timeout: {
|
|
||||||
type: Number,
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
isEdit: false,
|
|
||||||
isReady: false,
|
|
||||||
tempLink: this.$props.videoLink,
|
|
||||||
realLink: this.$props.videoLink,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
isLinkNormal() {
|
|
||||||
return this.$data.realLink.toString().includes("https://www.youtube.com/watch?")
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
if (this.timeout) {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.isReady = true
|
|
||||||
}, this.timeout);
|
|
||||||
} else {
|
|
||||||
this.isReady = true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
updateLink(newLink) {
|
|
||||||
console.log(newLink)
|
|
||||||
},
|
|
||||||
clickSave() {
|
|
||||||
this.$data.isEdit = false
|
|
||||||
let l = this.$data.tempLink
|
|
||||||
if (l.toString().includes("https://www.youtube.com/watch?")) {
|
|
||||||
this.$data.realLink = l
|
|
||||||
}
|
|
||||||
},
|
|
||||||
clickDiscard() {
|
|
||||||
this.$data.isEdit = false
|
|
||||||
console.log(`discard ${this.$data.tempLink}`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@ -4,21 +4,21 @@
|
|||||||
btnClass="col-span-4"
|
btnClass="col-span-4"
|
||||||
containerClass="pt-10 px-4 min-w-[80vw]"
|
containerClass="pt-10 px-4 min-w-[80vw]"
|
||||||
>
|
>
|
||||||
<Tabulator v-bind="tabulatorOtps" />
|
<Tabulator v-bind="tabulatorOptions" />
|
||||||
</ButtonModal>
|
</ButtonModal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ButtonModal from '@molecules/ButtonModal/index.vue'
|
import ButtonModal from '@molecules/ButtonModal/ButtonModal.vue'
|
||||||
import Tabulator from "@molecules/Tabulator/index.vue"
|
import Tabulator from "@molecules/Tabulator/index.vue"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Name',
|
name: 'MachinesModal',
|
||||||
components: {ButtonModal, Tabulator},
|
components: {ButtonModal, Tabulator},
|
||||||
data() {
|
data() {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
tabulatorOtps() {
|
tabulatorOptions() {
|
||||||
return {
|
return {
|
||||||
dataSource: this.packsData,
|
dataSource: this.packsData,
|
||||||
columns: [
|
columns: [
|
||||||
@ -71,7 +71,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import TaskModal from './TaskModal.vue'
|
import TaskModal from './TaskModal.vue'
|
||||||
import TaskHistory from './TaskHistory.vue'
|
import TaskHistory from './TaskHistory.vue'
|
||||||
import ButtonModal from '@molecules/ButtonModal/index.vue'
|
import ButtonModal from '@molecules/ButtonModal/ButtonModal.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Task',
|
name: 'Task',
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ButtonModal from '@molecules/ButtonModal/index.vue'
|
import ButtonModal from '@molecules/ButtonModal/ButtonModal.vue'
|
||||||
import {data} from './historyData'
|
import {data} from './historyData'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@ -220,7 +220,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ButtonModal from '@molecules/ButtonModal/index.vue'
|
import ButtonModal from '@molecules/ButtonModal/ButtonModal.vue'
|
||||||
import Datepicker from "@molecules/Datepicker/index.vue"
|
import Datepicker from "@molecules/Datepicker/index.vue"
|
||||||
import { FwbTextarea } from 'flowbite-vue'
|
import { FwbTextarea } from 'flowbite-vue'
|
||||||
|
|
||||||
|
|||||||
@ -101,12 +101,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ButtonModal from '@molecules/ButtonModal/index.vue'
|
import ButtonModal from '@molecules/ButtonModal/ButtonModal.vue'
|
||||||
import Datepicker from "@molecules/Datepicker/index.vue"
|
import Datepicker from "@molecules/Datepicker/index.vue"
|
||||||
import {mapGetters, mapMutations, mapActions} from 'vuex'
|
import {mapGetters, mapMutations, mapActions} from 'vuex'
|
||||||
import Tabulator from "@molecules/Tabulator/index.vue"
|
import Tabulator from "@molecules/Tabulator/index.vue"
|
||||||
import Spinner from "@molecules/Spinner/index.vue"
|
import Spinner from "@molecules/Spinner/index.vue"
|
||||||
import MachinesModal from "@organisms/MachinesModal/index.vue"
|
import MachinesModal from "@molecules/MachinesModal/MachinesModal.vue"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'LastPacks',
|
name: 'LastPacks',
|
||||||
|
|||||||
@ -78,7 +78,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ButtonModal from '@molecules/ButtonModal/index.vue'
|
import ButtonModal from '@molecules/ButtonModal/ButtonModal.vue'
|
||||||
import {mapGetters, mapMutations, mapActions} from 'vuex'
|
import {mapGetters, mapMutations, mapActions} from 'vuex'
|
||||||
import Tabulator from "@molecules/Tabulator/index.vue"
|
import Tabulator from "@molecules/Tabulator/index.vue"
|
||||||
import Spinner from "@molecules/Spinner/index.vue"
|
import Spinner from "@molecules/Spinner/index.vue"
|
||||||
@ -98,8 +98,6 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
...mapGetters('last_packs_num', ['packNum', 'pageState', 'packsData']),
|
...mapGetters('last_packs_num', ['packNum', 'pageState', 'packsData']),
|
||||||
tabulatorOtps() {
|
tabulatorOtps() {
|
||||||
console.log(this.packsData)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
dataSource: this.packsData,
|
dataSource: this.packsData,
|
||||||
columns: [
|
columns: [
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { createStore, createLogger } from 'vuex';
|
import { createStore, createLogger } from 'vuex';
|
||||||
import { store as main } from '@/store/modules/main';
|
import { store as main } from '@/store/modules/main';
|
||||||
import { store as machines } from '@/store/modules/machines';
|
import { store as machines } from '@/store/modules/machines';
|
||||||
import { store as layoutMachines } from '@/store/modules/machines';
|
import { store as layoutMachines } from '@/store/modules/layoutMachines';
|
||||||
import { store as finder_packs } from '@/store/modules/finder_packs';
|
import { store as finder_packs } from '@/store/modules/finder_packs';
|
||||||
import { store as add_users } from '@/store/modules/add_users';
|
import { store as add_users } from '@/store/modules/add_users';
|
||||||
import { store as layout } from '@/store/modules/layout';
|
import { store as layout } from '@/store/modules/layout';
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import {describe, test, expect} from 'vitest'
|
import {describe, test, expect, vi} from 'vitest'
|
||||||
import AdapterOfMachines from "@adapters/AdapterOfMachines.js"
|
import AdapterOfMachines from "@adapters/AdapterOfMachines.js"
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import {apiModalListMachines, appModalListMachines} from "@mocks/machines.js"
|
import {apiModalListMachines, appModalListMachines} from "@mocks/machines.js"
|
||||||
|
|||||||
@ -0,0 +1,15 @@
|
|||||||
|
import {describe, test, expect, vi} from 'vitest'
|
||||||
|
import AdapterOfPacks from "@adapters/AdapterOfPacks.js"
|
||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
|
vi.mock('axios')
|
||||||
|
|
||||||
|
describe('AdapterOfMachines', () => {
|
||||||
|
axios.post.mockResolvedValue({data: []})
|
||||||
|
|
||||||
|
test('AdapterOfMachines should be a object', () => {
|
||||||
|
const adapterOfMachines = new AdapterOfPacks('')
|
||||||
|
expect(typeof adapterOfMachines).toBe('object')
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
10
live_monitor_vue/tests/components/1_atoms/Accordion.test.js
Normal file
10
live_monitor_vue/tests/components/1_atoms/Accordion.test.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import {test, describe, expect} from 'vitest'
|
||||||
|
import { mount} from '@vue/test-utils'
|
||||||
|
import Accordion from '@atoms/Accordion.vue';
|
||||||
|
|
||||||
|
describe('Accordion', () => {
|
||||||
|
test('Accordion mounted', () => {
|
||||||
|
const wrapper = mount(Accordion)
|
||||||
|
expect(wrapper.exists()).toBe(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
10
live_monitor_vue/tests/components/1_atoms/Button.test.js
Normal file
10
live_monitor_vue/tests/components/1_atoms/Button.test.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import {test, describe, expect} from 'vitest'
|
||||||
|
import { mount} from '@vue/test-utils'
|
||||||
|
import Button from '@atoms/Button.vue';
|
||||||
|
|
||||||
|
describe('Accordion', () => {
|
||||||
|
test('Accordion mounted', () => {
|
||||||
|
const wrapper = mount(Button)
|
||||||
|
expect(wrapper.exists()).toBe(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
import {test, describe, expect} from 'vitest'
|
||||||
|
import { mount} from '@vue/test-utils'
|
||||||
|
import ButtonDiscard from '@atoms/ButtonDiscard.vue';
|
||||||
|
|
||||||
|
describe('ButtonDiscard', () => {
|
||||||
|
test('ButtonDiscard mounted', () => {
|
||||||
|
const wrapper = mount(ButtonDiscard)
|
||||||
|
expect(wrapper.exists()).toBe(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
10
live_monitor_vue/tests/components/1_atoms/ButtonEdit.test.js
Normal file
10
live_monitor_vue/tests/components/1_atoms/ButtonEdit.test.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import {test, describe, expect} from 'vitest'
|
||||||
|
import { mount} from '@vue/test-utils'
|
||||||
|
import ButtonEdit from '@atoms/ButtonEdit.vue';
|
||||||
|
|
||||||
|
describe('ButtonEdit', () => {
|
||||||
|
test('ButtonEdit mounted', () => {
|
||||||
|
const wrapper = mount(ButtonEdit)
|
||||||
|
expect(wrapper.exists()).toBe(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
10
live_monitor_vue/tests/components/1_atoms/ButtonSave.test.js
Normal file
10
live_monitor_vue/tests/components/1_atoms/ButtonSave.test.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import {test, describe, expect} from 'vitest'
|
||||||
|
import { mount} from '@vue/test-utils'
|
||||||
|
import ButtonSave from '@atoms/ButtonSave.vue';
|
||||||
|
|
||||||
|
describe('ButtonSave', () => {
|
||||||
|
test('ButtonSave mounted', () => {
|
||||||
|
const wrapper = mount(ButtonSave)
|
||||||
|
expect(wrapper.exists()).toBe(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
import {test, describe, expect} from 'vitest'
|
||||||
|
import { mount} from '@vue/test-utils'
|
||||||
|
import DoubleSwitch from '@atoms/DoubleSwitch.vue';
|
||||||
|
|
||||||
|
describe('DoubleSwitch', () => {
|
||||||
|
test('DoubleSwitch mounted', () => {
|
||||||
|
const wrapper = mount(DoubleSwitch)
|
||||||
|
expect(wrapper.exists()).toBe(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
import {test, describe, expect, vi} from 'vitest'
|
||||||
|
import { mount} from '@vue/test-utils'
|
||||||
|
import ButtonModal from '@molecules/ButtonModal/ButtonModal.vue';
|
||||||
|
|
||||||
|
describe('ButtonModal', () => {
|
||||||
|
test('ButtonModal mounted', () => {
|
||||||
|
const wrapper = mount(ButtonModal)
|
||||||
|
expect(wrapper.exists()).toBe(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
import {test, describe, expect, vi} from 'vitest'
|
||||||
|
import { mount} from '@vue/test-utils'
|
||||||
|
import MachinesModal from '@molecules/MachinesModal/MachinesModal.vue';
|
||||||
|
|
||||||
|
describe('MachinesModal', () => {
|
||||||
|
test('MachinesModal mounted', () => {
|
||||||
|
const wrapper = mount(MachinesModal)
|
||||||
|
expect(wrapper.exists()).toBe(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import Service from './Service.vue'
|
import Service from '@admin_pages/Services/Service.vue'
|
||||||
import { globalServices } from '@store/modules/services/StaticData'
|
import { globalServices } from '@store/modules/services/StaticData'
|
||||||
import { shallowMount, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import {createStore} from 'vuex'
|
import {createStore} from 'vuex'
|
||||||
|
|
||||||
const store = createStore({
|
const store = createStore({
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import Services from './index.vue'
|
import Services from '@admin_pages/Services/index.vue'
|
||||||
import { globalServices } from '@store/modules/services/StaticData'
|
import { globalServices } from '@store/modules/services/StaticData'
|
||||||
import { shallowMount, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import {createStore} from 'vuex'
|
import {createStore} from 'vuex'
|
||||||
|
|
||||||
const store = createStore({
|
const store = createStore({
|
||||||
Loading…
x
Reference in New Issue
Block a user