Skip to content

Commit

Permalink
Cleanup unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JanAckermann committed Jul 29, 2022
1 parent 7c5e376 commit edb9b00
Showing 1 changed file with 1 addition and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ const simpleOwnFile = {
size: '740'
}

const simpleDeletedFile = {
type: 'file',
ownerId: 'bob',
ownerDisplayName: 'Bob',
ddate: 'Wed, 21 Oct 2015 09:29:00 GMT'
}

const localVue = createLocalVue()
localVue.use(Vuex)
localVue.use(GetTextPlugin, {
Expand All @@ -29,30 +22,17 @@ localVue.use(GetTextPlugin, {
})

const selectors = {
name: '[data-testid="files-info-name"]',
mdate: '[data-testid="files-info-mdate"]'
}

const formDateFromRFC = jest.fn()
const formRelativeDateFromRFC = jest.fn()
const resetDateMocks = () => {
formDateFromRFC.mockReset()
formRelativeDateFromRFC.mockReset()
formDateFromRFC.mockImplementation(() => 'ABSOLUTE_TIME')
formRelativeDateFromRFC.mockImplementation(() => 'RELATIVE_TIME')
name: '[data-testid="files-info-name"]'
}

describe('FileInfo', () => {
it('shows file info', () => {
resetDateMocks()

const tooltipStub = jest.fn()
const wrapper = createWrapper(simpleOwnFile, tooltipStub)
expect(wrapper.find(selectors.name).exists()).toBeTruthy()
})
})


function createWrapper(testResource, tooltipStub, routeName, privateLinksEnabled = false) {
return shallowMount(FileInfo, {
store: new Vuex.Store({
Expand Down Expand Up @@ -86,14 +66,6 @@ function createWrapper(testResource, tooltipStub, routeName, privateLinksEnabled
directives: {
OcTooltip: tooltipStub
},
mixins: [
{
methods: {
formDateFromRFC,
formRelativeDateFromRFC
}
}
],
mocks: {
$route: {
path: '/files'
Expand Down

0 comments on commit edb9b00

Please sign in to comment.