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

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

Merged
merged 5 commits into from
Nov 14, 2022
Merged

Conversation

JammingBen
Copy link
Collaborator

@JammingBen JammingBen commented Nov 10, 2022

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
Copy link
Member

@dschmidt dschmidt left a comment

Choose a reason for hiding this comment

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

🎉 🥳 🎉 🥳 🎉

packages/web-app-files/tests/__fixtures__/files.ts Outdated Show resolved Hide resolved
packages/web-app-files/tests/__fixtures__/spaces.ts Outdated Show resolved Hide resolved
sideBarActivePanel: ref(''),
...options
}
}
Copy link
Member

Choose a reason for hiding this comment

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

💖 💖 💖 💖 💖 💖

Copy link
Member

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
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

Copy link
Collaborator Author

@JammingBen JammingBen Nov 11, 2022

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.

packages/web-pkg/src/utils/types.ts Show resolved Hide resolved
$uppyService: mockDeep<UppyService>(),
...(gettext && {
$gettextInterpolate: jest.fn(),
$ngettext: jest.fn(),
$pgettext: jest.fn(),
$gettext: jest.fn()
$gettext: jest.fn((text) => text)
Copy link
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
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
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
Copy link

CLAassistant commented Nov 11, 2022

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
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

@sonarcloud
Copy link

sonarcloud bot commented Nov 11, 2022

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
Copy link
Member

@kulmann kulmann left a comment

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
Member

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 join this conversation on GitHub. Already have an account? Sign in to comment
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