Use more meaningful examples in insertTips specs

parent 36efeee5
...@@ -68,14 +68,10 @@ default: ...@@ -68,14 +68,10 @@ default:
describe('insertTips', () => { describe('insertTips', () => {
const validTips = [ const validTips = [
{ { tip: 'Tip 1', token: 'default:' },
tip: 'Tip 1', { tip: 'Tip 2', token: 'artifacts:' },
token: 'stages:', { tip: 'Tip 3', token: 'expire_in:' },
}, { tip: 'Tip 4', token: 'tags:' },
{
tip: 'Tip 2',
token: 'variables:',
},
]; ];
it.each(nonStringValues)('throws if snippet is not a string', (snippet) => { it.each(nonStringValues)('throws if snippet is not a string', (snippet) => {
...@@ -103,24 +99,20 @@ describe('insertTips', () => { ...@@ -103,24 +99,20 @@ describe('insertTips', () => {
}); });
it('returns the snippet with properly inserted tips', () => { it('returns the snippet with properly inserted tips', () => {
const snippet = ` const snippet = `default:
--- artifacts:
stages: expire_in: 30 days
- fuzz tags:
include: - gitlab-org`;
- template: template.gitlab-cy.yml const expected = `# Tip 1
variables: default:
- FOO: bar`; # Tip 2
const expected = ` artifacts:
--- # Tip 3
# Tip 1 expire_in: 30 days
stages: # Tip 4
- fuzz tags:
include: - gitlab-org`;
- template: template.gitlab-cy.yml
# Tip 2
variables:
- FOO: bar`;
expect(insertTips(snippet, validTips)).toBe(expected); expect(insertTips(snippet, validTips)).toBe(expected);
}); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment