mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
locations: fix frontend test for selecting new location
This commit is contained in:
parent
05adf4a9f1
commit
73cc1b1fa1
@ -156,14 +156,22 @@ describe('index.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('given a new location and hitting submit', () => {
|
describe('given a new location and hitting submit', () => {
|
||||||
it('calls updateUser mutation', () => {
|
it('calls updateUser mutation', async () => {
|
||||||
const wrapper = Wrapper()
|
const wrapper = Wrapper()
|
||||||
|
wrapper.setData({
|
||||||
wrapper.find('#city').setValue('Berlin, Germany')
|
cities: [
|
||||||
wrapper.find('#city').trigger('input')
|
{
|
||||||
|
label: 'Berlin, Germany',
|
||||||
|
value: 'Berlin, Germany',
|
||||||
|
id: '1',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
await wrapper.vm.$nextTick()
|
||||||
|
wrapper.find('.ds-select-option').trigger('click')
|
||||||
wrapper.find('.ds-form').trigger('submit')
|
wrapper.find('.ds-form').trigger('submit')
|
||||||
|
|
||||||
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
|
await expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
variables: expect.objectContaining({
|
variables: expect.objectContaining({
|
||||||
locationName: 'Berlin, Germany',
|
locationName: 'Berlin, Germany',
|
||||||
@ -191,21 +199,36 @@ describe('index.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('given new username, slug, location and about then hitting submit', () => {
|
describe('given new username, slug, location and about then hitting submit', () => {
|
||||||
it('calls updateUser mutation', () => {
|
it('calls updateUser mutation', async () => {
|
||||||
const wrapper = Wrapper()
|
const wrapper = Wrapper()
|
||||||
|
|
||||||
|
wrapper.setData({
|
||||||
|
cities: [
|
||||||
|
{
|
||||||
|
label: 'Berlin, Germany',
|
||||||
|
value: 'Berlin, Germany',
|
||||||
|
id: '1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Hamburg, Germany',
|
||||||
|
value: 'Hamburg, Germany',
|
||||||
|
id: '2',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
await wrapper.vm.$nextTick()
|
||||||
wrapper.find('#name').setValue('Peter')
|
wrapper.find('#name').setValue('Peter')
|
||||||
wrapper.find('#slug').setValue('peter-der-lustige')
|
wrapper.find('#slug').setValue('peter-der-lustige')
|
||||||
wrapper.find('#city').setValue('Berlin, Germany')
|
wrapper.findAll('.ds-select-option').at(1).trigger('click')
|
||||||
wrapper.find('#about').setValue('I am Peter!111elf')
|
wrapper.find('#about').setValue('I am Peter!111elf')
|
||||||
wrapper.find('.ds-form').trigger('submit')
|
wrapper.find('.ds-form').trigger('submit')
|
||||||
|
|
||||||
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
|
await expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
variables: expect.objectContaining({
|
variables: expect.objectContaining({
|
||||||
name: 'Peter',
|
name: 'Peter',
|
||||||
slug: 'peter-der-lustige',
|
slug: 'peter-der-lustige',
|
||||||
locationName: 'Berlin, Germany',
|
locationName: 'Hamburg, Germany',
|
||||||
about: 'I am Peter!111elf',
|
about: 'I am Peter!111elf',
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user