Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cleanup unit tests, avoid warnings #7440

Merged
merged 1 commit into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions packages/web-app-files/src/mixins/actions/restore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default {
...mapState(['user']),
...mapState('runtime/spaces', ['spaces']),
...mapGetters(['configuration', 'capabilities']),
...mapGetters('runtime/auth', ['accessToken']),

$_restore_items() {
return [
Expand Down Expand Up @@ -111,10 +110,8 @@ export default {

// Load quota
if (this.capabilities?.spaces?.enabled) {
const graphClient = clientService.graphAuthenticated(
this.configuration.server,
this.accessToken
)
const accessToken = this.$store.getters['runtime/auth/accessToken']
const graphClient = clientService.graphAuthenticated(this.configuration.server, accessToken)
const driveId = isLocationTrashActive(this.$router, 'files-trash-spaces-project')
? this.$route.params.storageId
: this.spaces.find((s) => s.driveType === 'personal').id
Expand Down
7 changes: 2 additions & 5 deletions packages/web-app-files/src/mixins/spaces/actions/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { clientService } from 'web-pkg/src/services'
export default {
computed: {
...mapGetters(['configuration']),
...mapGetters('runtime/auth', ['accessToken']),
...mapState(['user']),

$_delete_items() {
Expand Down Expand Up @@ -61,10 +60,8 @@ export default {
},

$_delete_deleteSpace(id) {
const graphClient = clientService.graphAuthenticated(
this.configuration.server,
this.accessToken
)
const accessToken = this.$store.getters['runtime/auth/accessToken']
const graphClient = clientService.graphAuthenticated(this.configuration.server, accessToken)
return graphClient.drives
.deleteDrive(id, '', {
headers: {
Expand Down
7 changes: 2 additions & 5 deletions packages/web-app-files/src/mixins/spaces/actions/disable.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { createLocationSpaces, isLocationSpacesActive } from '../../../router'
export default {
computed: {
...mapGetters(['configuration']),
...mapGetters('runtime/auth', ['accessToken']),
...mapState(['user']),

$_disable_items() {
Expand Down Expand Up @@ -61,10 +60,8 @@ export default {
},

$_disable_disableSpace(id) {
const graphClient = clientService.graphAuthenticated(
this.configuration.server,
this.accessToken
)
const accessToken = this.$store.getters['runtime/auth/accessToken']
const graphClient = clientService.graphAuthenticated(this.configuration.server, accessToken)
return graphClient.drives
.deleteDrive(id)
.then(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { clientService } from 'web-pkg/src/services'
export default {
computed: {
...mapGetters(['configuration']),
...mapGetters('runtime/auth', ['accessToken']),

$_editDescription_items() {
return [
Expand Down Expand Up @@ -61,10 +60,8 @@ export default {
},

$_editDescription_editDescriptionSpace(id, description) {
const graphClient = clientService.graphAuthenticated(
this.configuration.server,
this.accessToken
)
const accessToken = this.$store.getters['runtime/auth/accessToken']
const graphClient = clientService.graphAuthenticated(this.configuration.server, accessToken)
return graphClient.drives
.updateDrive(id, { description }, {})
.then(() => {
Expand Down
7 changes: 2 additions & 5 deletions packages/web-app-files/src/mixins/spaces/actions/rename.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { clientService } from 'web-pkg/src/services'
export default {
computed: {
...mapGetters(['configuration', 'user']),
...mapGetters('runtime/auth', ['accessToken']),

$_rename_items() {
return [
Expand Down Expand Up @@ -68,10 +67,8 @@ export default {
},

$_rename_renameSpace(id, name) {
const graphClient = clientService.graphAuthenticated(
this.configuration.server,
this.accessToken
)
const accessToken = this.$store.getters['runtime/auth/accessToken']
const graphClient = clientService.graphAuthenticated(this.configuration.server, accessToken)
return graphClient.drives
.updateDrive(id, { name }, {})
.then(() => {
Expand Down
7 changes: 2 additions & 5 deletions packages/web-app-files/src/mixins/spaces/actions/restore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { clientService } from 'web-pkg/src/services'
export default {
computed: {
...mapGetters(['configuration']),
...mapGetters('runtime/auth', ['accessToken']),
...mapState(['user']),

$_restore_items() {
Expand Down Expand Up @@ -60,10 +59,8 @@ export default {
},

$_restore_restoreSpace(id) {
const graphClient = clientService.graphAuthenticated(
this.configuration.server,
this.accessToken
)
const accessToken = this.$store.getters['runtime/auth/accessToken']
const graphClient = clientService.graphAuthenticated(this.configuration.server, accessToken)
return graphClient.drives
.updateDrive(
id,
Expand Down
7 changes: 2 additions & 5 deletions packages/web-app-files/src/mixins/spaces/actions/setImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export default {
},
computed: {
...mapGetters(['configuration']),
...mapGetters('runtime/auth', ['accessToken']),
...mapState(['user']),
$_setSpaceImage_items() {
return [
Expand Down Expand Up @@ -57,10 +56,8 @@ export default {
...mapMutations('runtime/spaces', ['UPDATE_SPACE_FIELD']),
...mapActions(['showMessage']),
async $_setSpaceImage_trigger({ resources }) {
const graphClient = clientService.graphAuthenticated(
this.configuration.server,
this.accessToken
)
const accessToken = this.$store.getters['runtime/auth/accessToken']
const graphClient = clientService.graphAuthenticated(this.configuration.server, accessToken)
const storageId = this.$route.params.storageId
const sourcePath = resources[0].webDavPath
const destinationPath = `/spaces/${storageId}/.space/${resources[0].name}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default {
},
computed: {
...mapState('Files', ['currentFolder']),
...mapGetters('runtime/auth', ['accessToken']),
...mapGetters(['configuration']),
$_uploadImage_items() {
return [
Expand Down Expand Up @@ -47,10 +46,8 @@ export default {
this.$refs.spaceImageInput.click()
},
$_uploadImage_uploadImageSpace(ev) {
const graphClient = clientService.graphAuthenticated(
this.configuration.server,
this.accessToken
)
const accessToken = this.$store.getters['runtime/auth/accessToken']
const graphClient = clientService.graphAuthenticated(this.configuration.server, accessToken)
const file = ev.currentTarget.files[0]

if (!file) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ function createStore(state = { selected: [] }) {
mutations: {
SET_HIDDEN_FILES_VISIBILITY: jest.fn(),
SET_FILE_EXTENSIONS_VISIBILITY: jest.fn()
},
modules: {
sidebar: {
namespaced: true,
state: {
closed: false
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ function createWrapper(testResource, tooltipStub, routeName, privateLinksEnabled
highlightedFile: function () {
return testResource
}
},
modules: {
sidebar: {
namespaced: true,
state: {
activePanel: null
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exports[`Collaborator ListItem component share inheritance indicators show when
</div>
<!---->
<edit-dropdown-stub sharecategory="user" caneditordelete="true" id="edit-drop-down-00000000-0000-0000-0000-000000000000" data-testid="collaborator-edit" class="files-collaborators-collaborator-edit"></edit-dropdown-stub>
<oc-info-drop mode="manual" target="#edit-drop-down-00000000-0000-0000-0000-000000000000" title="Access details" list="[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]" class="share-access-details-drop"></oc-info-drop>
<oc-info-drop-stub mode="manual" target="#edit-drop-down-00000000-0000-0000-0000-000000000000" title="Access details" list="[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]" class="share-access-details-drop"></oc-info-drop-stub>
</div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions packages/web-runtime/src/components/Avatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ export default {
}
},
computed: {
...mapGetters(['capabilities', 'configuration']),
...mapGetters('runtime/auth', ['accessToken'])
...mapGetters(['capabilities', 'configuration'])
},
watch: {
userid: function (userid) {
Expand All @@ -87,10 +86,11 @@ export default {
this.loading = false
return
}
const accessToken = this.$store.getters['runtime/auth/accessToken']
const headers = new Headers()
const instance = this.configuration.server || window.location.origin
const url = instance + 'remote.php/dav/avatars/' + userid + '/128.png'
headers.append('Authorization', 'Bearer ' + this.accessToken)
headers.append('Authorization', 'Bearer ' + accessToken)
headers.append('X-Requested-With', 'XMLHttpRequest')
fetch(url, { headers })
.then((response) => {
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/stubs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ export default {
'router-link': true,
'portal-target': true,
'oc-progress': true,
'oc-status-indicators': true
'oc-status-indicators': true,
'oc-info-drop': true
}