Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into uploadIntoShared
Browse files Browse the repository at this point in the history
  • Loading branch information
ScharfViktor committed Aug 16, 2021
2 parents 198d379 + a75f853 commit c0bd391
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 6 deletions.
10 changes: 5 additions & 5 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -2660,11 +2660,6 @@ def dependsOn(earlierStages, nextStages):
nextStage["depends_on"] = [earlierStage["name"]]

def calculateDiffContainsUnitTestsOnly(ctx):
# Do all the pipeline steps fully on tag events. Do not try to analyze diffs
# and short-circuit the tests that are executed.
if ctx.build.event == "tag":
return []

return [
{
"name": "calculate-diff",
Expand All @@ -2674,5 +2669,10 @@ def calculateDiffContainsUnitTestsOnly(ctx):
"bash -x tests/drone/if-diff-has-unit-tests-only.sh",
"ls -la",
],
"when": {
"event": [
"pull_request",
],
},
},
]
51 changes: 51 additions & 0 deletions packages/web-app-files/tests/unit/helpers/permissions.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { canBeMoved } from '@files/src/helpers/permissions.js'

describe('permissions helper', () => {
describe('canBeMoved function', () => {
it.each([
{ isReceivedShare: false, isMounted: false, canBeDeleted: true, parentPath: '' },
{ isReceivedShare: false, isMounted: false, canBeDeleted: true, parentPath: 'folder' },
{ isReceivedShare: true, isMounted: false, canBeDeleted: true, parentPath: 'folder' },
{ isReceivedShare: false, isMounted: true, canBeDeleted: true, parentPath: 'folder' }
])(
'should return true if the given resource can be deleted and if it is not mounted in root',
input => {
// resources are supposed to be external if it is a received share or is mounted
// resources are supposed to be mountedInRoot if its parentPath is an empty string and resource is external
expect(
canBeMoved(
{
isReceivedShare: () => input.isReceivedShare,
isMounted: () => input.isMounted,
canBeDeleted: () => input.canBeDeleted
},
input.parentPath
)
).toBeTruthy()
}
)
it.each([
{ isReceivedShare: false, isMounted: false, canBeDeleted: false, parentPath: '' },
{ isReceivedShare: false, isMounted: false, canBeDeleted: false, parentPath: 'folder' },
{ isReceivedShare: true, isMounted: false, canBeDeleted: false, parentPath: 'folder' },
{ isReceivedShare: false, isMounted: true, canBeDeleted: false, parentPath: 'folder' },
{ isReceivedShare: false, isMounted: true, canBeDeleted: true, parentPath: '' },
{ isReceivedShare: true, isMounted: false, canBeDeleted: true, parentPath: '' },
{ isReceivedShare: true, isMounted: true, canBeDeleted: true, parentPath: '' }
])(
'should return false if the given resource cannot be deleted or if it is mounted in root',
input => {
expect(
canBeMoved(
{
isReceivedShare: () => input.isReceivedShare,
isMounted: () => input.isMounted,
canBeDeleted: () => input.canBeDeleted
},
input.parentPath
)
).toBeFalsy()
}
)
})
})
5 changes: 4 additions & 1 deletion tests/drone/if-diff-has-unit-tests-only.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ do
fi
done

if [ $CHANGED_UNIT_TESTS_ONLY == "True" ]
if [ ! "${DIFF}" ]
then
echo "no any files are changed"
elif [ $CHANGED_UNIT_TESTS_ONLY == "True" ]
then
echo "only unit tests files are changed"
touch runUnitTestsOnly
Expand Down

0 comments on commit c0bd391

Please sign in to comment.