Last active
May 9, 2020 21:00
-
-
Save luizamboni/c632a0394e7cac6eadab491919d8b9eb to your computer and use it in GitHub Desktop.
link spec in strapi tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { expect } = require('chai'); | |
describe('strapi.services.link', () => { | |
describe('#create', () => { | |
context('with invalid data', () => { | |
it('should fails', async () => { | |
try { | |
await strapi.services.link.create({ | |
name: "invalid", | |
url: 'invalid-url-formt' | |
}) | |
} catch(err) { | |
expect(err.message).to.be.eqls( | |
'url field should be a valid url' | |
) | |
} | |
}) | |
}) | |
context('with valid data', () => { | |
it('should create', async () => { | |
const pageContent = await strapi.services.link.create({ | |
name: "invalid", | |
url: 'https://valid.url.format' | |
}) | |
expect(pageContent).to.be.not.null | |
}) | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment