Prettier format all js files
This commit is contained in:
@@ -15,8 +15,8 @@ describe('ConfirmationPopover', () => {
|
||||
cancel_btn_text: 'Cancel',
|
||||
confirm_btn_text: 'Confirm',
|
||||
confirm_msg: 'Are you sure you want to do that?',
|
||||
csrf_token: '42'
|
||||
}
|
||||
csrf_token: '42',
|
||||
},
|
||||
})
|
||||
|
||||
it('matches snapshot', () => {
|
||||
@@ -29,4 +29,3 @@ describe('ConfirmationPopover', () => {
|
||||
expect(input.attributes('value')).toBe('42')
|
||||
})
|
||||
})
|
||||
|
||||
|
@@ -2,9 +2,10 @@ import { shallowMount } from '@vue/test-utils'
|
||||
|
||||
import LocalDatetime from '../local_datetime'
|
||||
|
||||
|
||||
describe('LocalDatetime', () => {
|
||||
const wrapper = shallowMount(LocalDatetime, { propsData: { timestamp: '1977-05-25 00:00:00' } })
|
||||
const wrapper = shallowMount(LocalDatetime, {
|
||||
propsData: { timestamp: '1977-05-25 00:00:00' },
|
||||
})
|
||||
|
||||
it('renders a time element', () => {
|
||||
expect(wrapper.html()).toContain('<time')
|
||||
@@ -16,14 +17,12 @@ describe('LocalDatetime', () => {
|
||||
})
|
||||
|
||||
it('allows specifying a custom format', () => {
|
||||
const wrapperWithCustomFormat = shallowMount(
|
||||
LocalDatetime, {
|
||||
propsData: {
|
||||
timestamp: '1977-05-25 00:00:00',
|
||||
format: 'MMM Do YY'
|
||||
}
|
||||
}
|
||||
)
|
||||
const wrapperWithCustomFormat = shallowMount(LocalDatetime, {
|
||||
propsData: {
|
||||
timestamp: '1977-05-25 00:00:00',
|
||||
format: 'MMM Do YY',
|
||||
},
|
||||
})
|
||||
expect(wrapperWithCustomFormat).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
|
@@ -3,17 +3,20 @@ import { shallowMount } from '@vue/test-utils'
|
||||
import MembersList from '../members_list'
|
||||
|
||||
describe('MembersList', () => {
|
||||
const members = [{
|
||||
name: 'Luke Skywalker',
|
||||
num_env: 2,
|
||||
status: 'active',
|
||||
role: 'developer'
|
||||
}, {
|
||||
name: 'Chewie',
|
||||
num_env: 3,
|
||||
status: 'pending',
|
||||
role: 'admin'
|
||||
}]
|
||||
const members = [
|
||||
{
|
||||
name: 'Luke Skywalker',
|
||||
num_env: 2,
|
||||
status: 'active',
|
||||
role: 'developer',
|
||||
},
|
||||
{
|
||||
name: 'Chewie',
|
||||
num_env: 3,
|
||||
status: 'pending',
|
||||
role: 'admin',
|
||||
},
|
||||
]
|
||||
const role_choices = [
|
||||
{ display_name: 'Developer', name: 'developer' },
|
||||
{ display_name: 'Admin', name: 'admin' },
|
||||
@@ -23,11 +26,14 @@ describe('MembersList', () => {
|
||||
{ display_name: 'Pending', name: 'pending' },
|
||||
]
|
||||
|
||||
const createWrapper = () => shallowMount(MembersList, {
|
||||
propsData: {
|
||||
members, role_choices, status_choices
|
||||
}
|
||||
})
|
||||
const createWrapper = () =>
|
||||
shallowMount(MembersList, {
|
||||
propsData: {
|
||||
members,
|
||||
role_choices,
|
||||
status_choices,
|
||||
},
|
||||
})
|
||||
|
||||
it('should sort by name by default', () => {
|
||||
const wrapper = createWrapper()
|
||||
|
@@ -3,17 +3,20 @@ import { shallowMount } from '@vue/test-utils'
|
||||
import RequestsList from '../requests_list'
|
||||
|
||||
describe('RequestsList', () => {
|
||||
|
||||
describe('isExtended', () => {
|
||||
it('should disallow sorting if not extended', () => {
|
||||
const wrapper = shallowMount(RequestsList, { propsData: { isExtended: false } })
|
||||
const wrapper = shallowMount(RequestsList, {
|
||||
propsData: { isExtended: false },
|
||||
})
|
||||
expect(wrapper.vm.sort.columnName).toEqual('')
|
||||
wrapper.vm.updateSortValue('full_name')
|
||||
expect(wrapper.vm.sort.columnName).toEqual('')
|
||||
})
|
||||
|
||||
it('should allow sorting when in extended mode', () => {
|
||||
const wrapper = shallowMount(RequestsList, { propsData: { isExtended: true } })
|
||||
const wrapper = shallowMount(RequestsList, {
|
||||
propsData: { isExtended: true },
|
||||
})
|
||||
expect(wrapper.vm.sort.columnName).toEqual('last_submission_timestamp')
|
||||
wrapper.vm.updateSortValue('full_name')
|
||||
expect(wrapper.vm.sort.columnName).toEqual('full_name')
|
||||
@@ -21,25 +24,29 @@ describe('RequestsList', () => {
|
||||
})
|
||||
|
||||
describe('sorting', () => {
|
||||
const requests = [{
|
||||
name: 'X Wing',
|
||||
last_edited_timestamp: 'Mon, 2 Jan 2017 12:34:56 GMT',
|
||||
last_submission_timestamp: 'Mon, 2 Jan 2017 12:34:56 GMT',
|
||||
full_name: 'Luke Skywalker',
|
||||
annual_usage: '80000',
|
||||
status: 'Approved',
|
||||
dod_component: 'Rebels'
|
||||
}, {
|
||||
name: 'TIE Fighter',
|
||||
last_edited_timestamp: 'Mon, 12 Nov 2018 12:34:56 GMT',
|
||||
last_submission_timestamp: 'Mon, 12 Nov 2018 12:34:56 GMT',
|
||||
full_name: 'Darth Vader',
|
||||
annual_usage: '999999',
|
||||
status: 'Approved',
|
||||
dod_component: 'Empire'
|
||||
}]
|
||||
const requests = [
|
||||
{
|
||||
name: 'X Wing',
|
||||
last_edited_timestamp: 'Mon, 2 Jan 2017 12:34:56 GMT',
|
||||
last_submission_timestamp: 'Mon, 2 Jan 2017 12:34:56 GMT',
|
||||
full_name: 'Luke Skywalker',
|
||||
annual_usage: '80000',
|
||||
status: 'Approved',
|
||||
dod_component: 'Rebels',
|
||||
},
|
||||
{
|
||||
name: 'TIE Fighter',
|
||||
last_edited_timestamp: 'Mon, 12 Nov 2018 12:34:56 GMT',
|
||||
last_submission_timestamp: 'Mon, 12 Nov 2018 12:34:56 GMT',
|
||||
full_name: 'Darth Vader',
|
||||
annual_usage: '999999',
|
||||
status: 'Approved',
|
||||
dod_component: 'Empire',
|
||||
},
|
||||
]
|
||||
|
||||
const mountWrapper = () => shallowMount(RequestsList, { propsData: { requests, isExtended: true } })
|
||||
const mountWrapper = () =>
|
||||
shallowMount(RequestsList, { propsData: { requests, isExtended: true } })
|
||||
|
||||
it('should default to sorting by submission recency', () => {
|
||||
const wrapper = mountWrapper()
|
||||
@@ -60,16 +67,20 @@ describe('RequestsList', () => {
|
||||
const unsubmittedRequest = {
|
||||
name: 'Death Star',
|
||||
status: 'Started',
|
||||
last_submission_timestamp: null
|
||||
last_submission_timestamp: null,
|
||||
}
|
||||
const wrapper = shallowMount(RequestsList, {
|
||||
propsData: {
|
||||
requests: [unsubmittedRequest, ...requests],
|
||||
isExtended: true
|
||||
}
|
||||
isExtended: true,
|
||||
},
|
||||
})
|
||||
const displayedRequests = wrapper.vm.filteredRequests
|
||||
expect(displayedRequests).toEqual([requests[1], requests[0], unsubmittedRequest])
|
||||
expect(displayedRequests).toEqual([
|
||||
requests[1],
|
||||
requests[0],
|
||||
unsubmittedRequest,
|
||||
])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user