Skip to content

Commit

Permalink
Address code review II
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalwengerter committed Dec 19, 2022
1 parent c69ac0c commit adbe049
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
import { shallowMount } from '@vue/test-utils'
import { shallowMount } from 'web-test-helpers'
import { AVAILABLE_SIZES } from '../../helpers/constants'
import { OcResourceIcon } from '..'

const resources = ['file', 'folder', 'space']

function getWrapper(props) {
return shallowMount(OcResourceIcon, {
propsData: {
resource: { type: props.resourceType },
size: props.size
}
})
}

describe('OcResourceIcon', () => {
resources.forEach((resourceType) => {
AVAILABLE_SIZES.forEach((size) => {
it(`renders OcIcon for resource type ${resourceType} in size ${size}`, () => {
const wrapper = getWrapper({ resourceType, size })
expect(wrapper).toMatchSnapshot()
const { wrapper } = getWrapper({ resourceType, size })
expect(wrapper.html()).toMatchSnapshot()
})
})
})
})

function getWrapper(props) {
return {
wrapper: shallowMount(OcResourceIcon as any, {
props: {
resource: { type: props.resourceType },
size: props.size
}
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { defineComponent, PropType } from 'vue'
import { Resource } from 'web-client'
import OcIcon from '../OcIcon/OcIcon.vue'
import { AVAILABLE_SIZES } from '../../helpers/constants'
import { AVAILABLE_SIZES } from '../../helpers'
import iconColorMap from '../../helpers/resourceIconColorExtensionMapping.json'
import iconNameMap from '../../helpers/resourceIconExtensionMapping.json'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export default defineComponent({
},
viewMode: {
type: String,
default: ViewModeConstants.default.name
default: ViewModeConstants.defaultModeName
},
/**
* Enable hover effect
Expand Down

0 comments on commit adbe049

Please sign in to comment.