mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Double-check changed expectations, fix tests
See: https://github.com/Human-Connection/Human-Connection/pull/478/files#r281267486 > We found the reason for it: If you have an exclamation mark in the schema e.g. > email! and the response would e.g. expect the email for each User object, and > the server does not have an email for the client, then the entire User object > gets nullified.
This commit is contained in:
parent
ee2e9409b1
commit
ad111f5701
@ -40,10 +40,13 @@ describe('authorization', () => {
|
||||
})
|
||||
|
||||
it('does not expose the owner\'s email address', async () => {
|
||||
let response = {}
|
||||
try {
|
||||
await action()
|
||||
} catch (error) {
|
||||
expect(error.response.data).toEqual({ User: [ null ] })
|
||||
response = error.response.data
|
||||
} finally {
|
||||
expect(response).toEqual({ User: [ null ] })
|
||||
}
|
||||
})
|
||||
})
|
||||
@ -74,11 +77,13 @@ describe('authorization', () => {
|
||||
})
|
||||
|
||||
it('does not expose the owner\'s email address', async () => {
|
||||
let response
|
||||
try {
|
||||
await action()
|
||||
} catch (error) {
|
||||
expect(error.response.data).toEqual({ User: [ null ] })
|
||||
response = error.response.data
|
||||
}
|
||||
expect(response).toEqual({ User: [ null ] })
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -49,12 +49,11 @@ describe('User', () => {
|
||||
return mount(User, { store, propsData, mocks, stubs, localVue })
|
||||
}
|
||||
|
||||
// TODO this is not working - mixin missing?
|
||||
/*it('renders anonymous user', () => {
|
||||
it('renders anonymous user', () => {
|
||||
const wrapper = Wrapper()
|
||||
expect(wrapper.text()).not.toMatch('Tilda Swinton')
|
||||
expect(wrapper.text()).toMatch('Anonymus')
|
||||
})*/
|
||||
expect(wrapper.text()).toBe('')
|
||||
expect(mocks.$t).toHaveBeenCalledWith('profile.userAnonym')
|
||||
})
|
||||
|
||||
describe('given an user', () => {
|
||||
beforeEach(() => {
|
||||
@ -66,7 +65,7 @@ describe('User', () => {
|
||||
|
||||
it('renders user name', () => {
|
||||
const wrapper = Wrapper()
|
||||
expect(wrapper.text()).not.toMatch('Anonymous')
|
||||
expect(mocks.$t).not.toHaveBeenCalledWith('profile.userAnonym')
|
||||
expect(wrapper.text()).toMatch('Tilda Swinton')
|
||||
})
|
||||
|
||||
@ -75,13 +74,11 @@ describe('User', () => {
|
||||
propsData.user.disabled = true
|
||||
})
|
||||
|
||||
// TODO recheck what we want to display if a user is disabled
|
||||
// it seems not reasonable to diplay Anonymous
|
||||
/*it('renders anonymous user', () => {
|
||||
it('renders anonymous user', () => {
|
||||
const wrapper = Wrapper()
|
||||
expect(wrapper.text()).not.toMatch('Tilda Swinton')
|
||||
expect(wrapper.text()).toMatch('Anonymus')
|
||||
})*/
|
||||
expect(mocks.$t).toHaveBeenCalledWith('profile.userAnonym')
|
||||
})
|
||||
|
||||
describe('current user is a moderator', () => {
|
||||
beforeEach(() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user