mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Add backend test for @mattwr18
This was already covered by `slugifyMiddleware.spec.js`. I do agree that this is a better place for it. Also we're not testing GraphQL requests here but the factories. As we're testing the existence of unique constraints, I think it won't matter if we use factories or actual GraphQL requests.
This commit is contained in:
parent
b7d70bbe90
commit
77d24b5a71
@ -29,6 +29,29 @@ describe('slug', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('must be unique', async done => {
|
||||
await instance.create('User', { slug: 'Matt' })
|
||||
try {
|
||||
await expect(instance.create('User', { slug: 'Matt' })).rejects.toThrow('already exists')
|
||||
done()
|
||||
} catch (error) {
|
||||
throw new Error(`
|
||||
${error}
|
||||
|
||||
Probably your database has no unique constraints!
|
||||
|
||||
To see all constraints go to http://localhost:7474/browser/ and
|
||||
paste the following:
|
||||
\`\`\`
|
||||
CALL db.constraints();
|
||||
\`\`\`
|
||||
|
||||
Learn how to setup the database here:
|
||||
https://docs.human-connection.org/human-connection/neo4j
|
||||
`)
|
||||
}
|
||||
})
|
||||
|
||||
describe('characters', () => {
|
||||
const createUser = attrs => {
|
||||
return instance.create('User', attrs).then(user => user.toJson())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user