Skip to content

Commit 74ec03b

Browse files
committed
updated generatedBy string and reversed the order; updated tests accordingly
1 parent ad08959 commit 74ec03b

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/store/cffstr.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ export function useCffstr () {
6060
const makeCffstr = () => {
6161
const kebabed = makeJavascriptObject()
6262
const yamlString = yaml.dump(kebabed, { indent: 2, sortKeys: true, lineWidth: 53 })
63-
const generatedBy = '# This CFF file was generated with cffinit at\n# https://bit.ly/cffinit.\n'
64-
return yamlString + generatedBy
63+
const generatedBy = '# This CITATION.cff file was generated with cffinit.\n# Visit https://bit.ly/cffinit to generate yours today!\n\n'
64+
return generatedBy + yamlString
6565
}
6666
return {
6767
jsObject: computed(makeJavascriptObject),

test/jest/__tests__/store/cffstr.jest.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { beforeEach, describe, expect, it } from '@jest/globals'
2-
import { useCff } from '../../../../src/store/cff'
3-
import { useCffstr } from '../../../../src/store/cffstr'
2+
import { useCff } from 'src/store/cff'
3+
import { useCffstr } from 'src/store/cffstr'
44

55
describe('useCffstr', () => {
66
const cff = useCff()
7-
const generatedBy = '# This CFF file was generated with cffinit at\n# https://bit.ly/cffinit.\n'
7+
const generatedBy = '# This CITATION.cff file was generated with cffinit.\n# Visit https://bit.ly/cffinit to generate yours today!\n\n'
88
const { cffstr } = useCffstr()
99

1010
beforeEach(() => {
1111
cff.reset()
1212
})
1313
describe('initial content', () => {
1414
it('should only have fields with defaults', () => {
15-
const expected = 'authors: []\ncff-version: 1.2.0\ntype: software\n' + generatedBy
15+
const expected = generatedBy + 'authors: []\ncff-version: 1.2.0\ntype: software\n'
1616
expect(cffstr.value).toEqual(expected)
1717
})
1818
})
@@ -23,7 +23,7 @@ describe('useCffstr', () => {
2323
})
2424

2525
it('should have title', () => {
26-
const expected = 'authors: []\ncff-version: 1.2.0\ntitle: sometitle\ntype: software\n' + generatedBy
26+
const expected = generatedBy + 'authors: []\ncff-version: 1.2.0\ntitle: sometitle\ntype: software\n'
2727
expect(cffstr.value).toEqual(expected)
2828
})
2929
})
@@ -34,7 +34,7 @@ describe('useCffstr', () => {
3434
})
3535

3636
it('should have a keyword', () => {
37-
const expected = 'authors: []\ncff-version: 1.2.0\nkeywords:\n - keyword1\ntype: software\n' + generatedBy
37+
const expected = generatedBy + 'authors: []\ncff-version: 1.2.0\nkeywords:\n - keyword1\ntype: software\n'
3838
expect(cffstr.value).toEqual(expected)
3939
})
4040
})
@@ -45,7 +45,7 @@ describe('useCffstr', () => {
4545
})
4646

4747
it('should have a identifier', () => {
48-
const expected = 'authors: []\ncff-version: 1.2.0\nidentifiers:\n - type: doi\n value: 10.5281/zenodo.5171937\ntype: software\n' + generatedBy
48+
const expected = generatedBy + 'authors: []\ncff-version: 1.2.0\nidentifiers:\n - type: doi\n value: 10.5281/zenodo.5171937\ntype: software\n'
4949
expect(cffstr.value).toEqual(expected)
5050
})
5151
})

0 commit comments

Comments
 (0)