Skip to content

Commit

Permalink
test(grease): update changelog fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
unicornware committed Sep 18, 2021
1 parent 5150d51 commit aabe44f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { SemanticVersion } from '@grease/types'

/**
* @file Workspace Test Fixture - CHANGELOG versions
* @module grease/tests/fixtures/changelog-versions
*/

export default [
'5.1.0',
'5.0.0',
'4.0.1',
'4.0.0',
'3.1.1',
'3.1.0',
'3.0.0',
'2.0.0',
'1.0.0'
] as SemanticVersion[]
36 changes: 0 additions & 36 deletions packages/grease/__tests__/__fixtures__/changelog.fixture.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { SemanticVersion } from '@grease/types'
import { readFileSync } from 'fs'
import { join } from 'path'

Expand All @@ -7,39 +6,4 @@ import { join } from 'path'
* @module grease/tests/fixtures/changelog
*/

export const VERSIONS: SemanticVersion[] = [
'5.1.0',
'5.0.0',
'4.0.1',
'4.0.0',
'3.1.1',
'3.1.0',
'3.0.0',
'2.0.0',
'1.0.0'
]

export const RELEASE_NOTES: Record<SemanticVersion, string> = {
'2.0.0': `## ⚠ BREAKING CHANGES
- **repo:** add MangoRepository
- **repo:** dtos, interfaces, types
## :hammer: Build
- **deps:** install repo api dependencies
([0c73e11](https://github.com/flex-development/mango/commit/0c73e11351468c6613560ea08d66d3c97a3ddee5))
## :sparkles: Features
- **decorators:** custom decorators
([32c3d47](https://github.com/flex-development/mango/commit/32c3d4767e7e8db90ca1a38381db55876cbfc2bc))
- **mixins:** add MangoValidator
([25a5df1](https://github.com/flex-development/mango/commit/25a5df10d69cc157b94215f2d794b61fb6a97b6c))
- **repo:** add MangoRepository
([00bf295](https://github.com/flex-development/mango/commit/00bf2958b8a68b81b97a1a695fa6f6d97ccef868))
- **repo:** dtos, interfaces, types
([1d0c286](https://github.com/flex-development/mango/commit/1d0c28660da03a92509c21016c9f99ab2b73cf62))`
}

export default `${readFileSync(join(__dirname, 'CHANGELOG.fixture.md'))}`
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import {
} from '@grease/config/constants.config'
import { NotesType } from '@grease/enums/notes-type.enum'
import type { IGreaseOptions } from '@grease/interfaces'
import {
RELEASE_NOTES,
VERSIONS
} from '@grease/tests/fixtures/changelog.fixture'
import VERSIONS from '@grease/tests/fixtures/changelog-versions.fixture'
import DTO from '@grease/tests/fixtures/create-release-dto.fixture'
import INFILE from '@grease/tests/fixtures/infile.fixture'
import type { SemanticVersion } from '@grease/types'
import changelogVersions from '@grease/utils/changelog-versions.util'
Expand Down Expand Up @@ -82,7 +80,7 @@ describe('unit:lifecycles/notes', () => {
version: '7.7.7'
},
{
expected: RELEASE_NOTES['2.0.0'],
expected: DTO.notes as string,
expected_string: 'changelog notes',
options,
state: 'options.notesType === NotesType.CHANGELOG',
Expand Down
2 changes: 1 addition & 1 deletion packages/grease/src/lifecycles/greaser.lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const Greaser = async (
logger(options, 'starting github release...', [], LogLevel.INFO)

// Validate release data
dto = await validate(CreateReleaseDTO, dto, false)
dto = await validate(CreateReleaseDTO, new CreateReleaseDTO(dto), false)

if (options.dryRun && !options.silent) {
const message = util.inspect(classToPlain(dto), false, null)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VERSIONS } from '@grease/tests/fixtures/changelog.fixture'
import VERSIONS from '@grease/tests/fixtures/changelog-versions.fixture'

/**
* @file User Module Mock - readPackageFiles
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { NullishString } from '@flex-development/tutils'
import CHANGELOG, { VERSIONS } from '@grease/tests/fixtures/changelog.fixture'
import VERSIONS from '@grease/tests/fixtures/changelog-versions.fixture'
import CHANGELOG from '@grease/tests/fixtures/changelog.fixture'
import type { SemanticVersion } from '@grease/types'
import type { Testcase } from '@tests/utils/types'
import testSubject from '../changelog-versions.util'
Expand Down

0 comments on commit aabe44f

Please sign in to comment.