Skip to content
This repository was archived by the owner on Nov 23, 2026. It is now read-only.

[tests-only] Add/refactor unit tests for views - #7945

Merged
kulmann merged 5 commits into
stable-6.0from
view-unit-tests
Nov 14, 2022
Merged

kulmann merged 5 commits into
stable-6.0from
view-unit-tests

Conversation

@JammingBen

@JammingBen JammingBen commented Nov 10, 2022 •

Copy link
Copy Markdown
Contributor

Description

Added/refactored unit tests for the following views:

  • GenericSpace
  • GenericTrash
  • SharedWithMe
  • SharedWithOthers
  • SharedViaLink
  • Projects
  • DriveResolver
  • Favorites
  • FilesDrop

Related Issue

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

@JammingBen JammingBen self-assigned this Nov 10, 2022
@JammingBen JammingBen changed the title [tests-only] Add tests for the GenericSpace view [tests-only] Add unit tests for views Nov 10, 2022
@JammingBen JammingBen changed the title [tests-only] Add unit tests for views [tests-only] Add/refactor unit tests for views Nov 11, 2022
@JammingBen
JammingBen marked this pull request as ready for review November 11, 2022 14:09

@dschmidt dschmidt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 🥳 🎉 🥳 🎉

sideBarActivePanel: ref(''),
...options
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💖 💖 💖 💖 💖 💖

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

smart 🤓

currentRoute: { name: 'files-common-favorites' }
}),
$client: {
publicFiles: { list: jest.fn(() => Promise.resolve([{ getProperty: jest.fn() }])) }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe beyond the scope of this PR, but can't we use the client/clientService mock here?
Possibly even worth porting to web-client

@JammingBen JammingBen Nov 11, 2022 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it to the deep mock in defaultComponentMocks for now 👍

Edit: Nvm, moved it back to the tests as discussed. Makes more sense to be there.

Comment thread packages/web-pkg/src/utils/types.ts Resolved
$ngettext: jest.fn(),
$pgettext: jest.fn(),
$gettext: jest.fn()
$gettext: jest.fn((text) => text)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

perPage: 10
}
})
}))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

$client: mockDeep<OwnCloudSdk>(),
$client: mockDeep<OwnCloudSdk>({
publicFiles: { list: jest.fn(() => Promise.resolve([{ getProperty: jest.fn() }])) }
}),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, I guess 😅

@JammingBen
JammingBen changed the base branch from master to stable-6.0 November 11, 2022 14:39
@JammingBen
JammingBen changed the base branch from stable-6.0 to master November 11, 2022 14:39
@JammingBen
JammingBen changed the base branch from master to stable-6.0 November 11, 2022 14:40
@CLAassistant

CLAassistant commented Nov 11, 2022 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

items: ComputedRef<Array<T>>
sortBy: ComputedRef<string>
sortDir: ComputedRef<SortDir>
items: MaybeRef<Array<T>>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this is a MaybeRef instead of a ReadOnlyRef because we use a Partial of this type as argument to a Mock Factory and it makes passing along the value easier

@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

88.0% 88.0% Coverage
0.0% 0.0% Duplication

@dschmidt dschmidt mentioned this pull request Nov 13, 2022
1 task

@kulmann kulmann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woah dude! ❤️

sideBarActivePanel: ref(''),
...options
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

smart 🤓

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No unit test coverage for views in files app [Drive alias followup]

4 participants