Последняя версия с сервера прошлого разработчика

This commit is contained in:
2025-07-10 04:35:51 +00:00
commit c731570032
1174 changed files with 134314 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
import { shallowMount } from '@vue/test-utils'
import { createRenderer } from 'vue-server-renderer'
import Index from '@/views/Index.vue'
// Create a renderer for snapshot testing
const renderer = createRenderer()
// Nova global mock
// class Nova {
// constructor(config) {}
// request() {
// return {
// get() {
// return { data: {} }
// },
// }
// }
// }
// global.Nova = new Nova()
describe('Index.vue', () => {
it('renders', () => {
const wrapper = shallowMount(Index, {
stubs: ['loading-view', 'cards'],
propsData: {
resourceName: 'posts',
},
})
renderer.renderToString(wrapper.vm, (err, str) => {
if (err) throw new Error(err)
expect(str).toMatchSnapshot()
})
})
it('renders after loading', () => {
const wrapper = shallowMount(Index, {
stubs: ['loading-view', 'cards'],
propsData: {
resourceName: 'posts',
},
})
expect(wrapper.vm.initialLoading).toEqual(false)
})
it('should show its cards', () => {
const $route = { params: { resourceName: 'posts' } }
const wrapper = shallowMount(Index, {
stubs: ['loading-view', 'cards'],
mocks: {
$route,
},
propsData: {
resourceName: 'posts',
},
})
// wrapper.setData({
// cards: [{}],
// })
expect(wrapper.vm.shouldShowCards).toEqual(true)
})
})

View File

@@ -0,0 +1,46 @@
import { mount, shallowMount, createLocalVue } from '@vue/test-utils'
import UpdateAttached from '@/views/UpdateAttached'
// import flushPromises from 'flush-promises'
describe('UpdateAttached', () => {
test('it loads all the available resources if its not searchable', () => {
window.Nova = {}
window.Nova.config = {
resources: [
{
uriKey: 'users',
label: 'Users',
singularLabel: 'User',
authorizedToCreate: true,
searchable: false,
},
{
uriKey: 'roles',
label: 'Roles',
singularLabel: 'Role',
authorizedToCreate: true,
searchable: false,
},
],
}
const wrapper = mount(UpdateAttached, {
propsData: {
resourceName: 'users',
resourceId: 100,
relatedResourceName: 'roles',
relatedResourceId: 25,
// viaResource: {},
// viaResourceId: {},
// viaRelationship: {},
// polymorphic: false,
},
})
wrapper.setData({
field: {},
})
// expect(wrapper).toMatchSnapshot()
})
})

View File

@@ -0,0 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Index.vue renders 1`] = `<loading-view-stub></loading-view-stub>`;

View File

@@ -0,0 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`UpdateAttached it loads all the available resources if its not searchable 1`] = `<div class="card overflow-hidden"></div>`;