-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(grease):
CreateReleaseDTO#toString
P010-33
- Loading branch information
1 parent
70156cb
commit 0347d26
Showing
11 changed files
with
349 additions
and
226 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* @file Node Module Mock - lodash/join | ||
* @module grease/tests/mocks/lodash/join | ||
* @see https://jestjs.io/docs/next/manual-mocks#mocking-node-modules | ||
* @see https://github.com/lodash/lodash | ||
*/ | ||
|
||
export default jest.fn((...args) => jest.requireActual('lodash/join')(...args)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* @file Node Module Mock - lodash/pick | ||
* @module grease/tests/mocks/lodash/pick | ||
* @see https://jestjs.io/docs/next/manual-mocks#mocking-node-modules | ||
* @see https://github.com/lodash/lodash | ||
*/ | ||
|
||
export default jest.fn((...args) => jest.requireActual('lodash/pick')(...args)) |
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
20 changes: 20 additions & 0 deletions
20
packages/grease/__tests__/__fixtures__/create-release-dto.fixture.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { ICreateReleaseDTO } from '@grease/interfaces' | ||
import { VERSION } from './git-tags.fixture' | ||
import NOTES from './notes.fixture' | ||
|
||
/** | ||
* @file Workspace Test Fixture - CreateReleaseDTO | ||
* @module grease/tests/fixtures/CreateReleaseDTO | ||
*/ | ||
|
||
export default { | ||
draft: true, | ||
files: ['./*.tgz', './README.md#My display label'], | ||
notes: NOTES, | ||
notesFile: undefined, | ||
prerelease: false, | ||
repo: 'flex-development/grease', | ||
target: 'main', | ||
title: undefined, | ||
version: `v${VERSION}` | ||
} as ICreateReleaseDTO |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* @file Workspace Test Fixture - Release Notes | ||
* @module grease/tests/fixtures/notes | ||
*/ | ||
|
||
export default `## ⚠ 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)) | ||
## :pencil2: Housekeeping | ||
- add \`deps-peer\` and \`yarn\` commit scopes | ||
([21905de](https://github.com/flex-development/log/commit/21905def9c8569ad255759ee677fcbb6bd9a7ca2)) | ||
- run \`yarn set version berry\` | ||
([4bcda50](https://github.com/flex-development/log/commit/4bcda50edbd75f013a6114edd7b9a6b5d6ff947e)) | ||
- **scripts:** add \`check:dedupe\` | ||
([8ed8ce6](https://github.com/flex-development/log/commit/8ed8ce6a8fc510d3e8171812a26f9e2fc79dcb49)) | ||
- **scripts:** add \`check:install\` | ||
([54304ea](https://github.com/flex-development/log/commit/54304eaa1e9284052a4296a6de79e9d2555641f0)) | ||
- **scripts:** add \`clean:modules\` and \`clean:yarn\` | ||
([8f2b31e](https://github.com/flex-development/log/commit/8f2b31e6125494a9d8bec60f4b7f050315880a2d)) | ||
- update \`lint-staged\` config | ||
([f875714](https://github.com/flex-development/log/commit/f87571445c8e1d5b3373b17fd2020641fec916d6)) | ||
- update environment variables | ||
([d8e08d5](https://github.com/flex-development/log/commit/d8e08d509f10e32c129c6abf7bba876853b8883b)) | ||
- **yarn:** add \`@yarnpkg/plugin-interactive-tools\` | ||
([aba5881](https://github.com/flex-development/log/commit/aba588102e332ca29dcd1383684b74a32992dda3))` |
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
46 changes: 46 additions & 0 deletions
46
packages/grease/src/dtos/__tests__/create-release.dto.functional.spec.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import DTO from '@grease/tests/fixtures/create-release-dto.fixture' | ||
import join from 'lodash/join' | ||
import pick from 'lodash/pick' | ||
import TestSubject from '../create-release.dto' | ||
|
||
/** | ||
* @file Functional Tests - CreateReleaseDTO | ||
* @module grease/dtos/tests/functional/CreateRelease | ||
*/ | ||
|
||
const mockJoin = join as jest.MockedFunction<typeof join> | ||
const mockPick = pick as jest.MockedFunction<typeof pick> | ||
|
||
describe('functional:dtos/CreateReleaseDTO', () => { | ||
describe('#constructor', () => { | ||
it('should pick CreateReleaseDTO properties from data', () => { | ||
// Arrange | ||
const data = { ...DTO, foo: 'data!' } | ||
|
||
// Act | ||
new TestSubject(data) | ||
|
||
// Expect | ||
expect(mockPick).toBeCalledTimes(1) | ||
expect(mockPick).toBeCalledWith(data, TestSubject.PROPS) | ||
}) | ||
}) | ||
|
||
describe('#toString', () => { | ||
const Subject = new TestSubject(DTO) | ||
const spy_toStringArgs = jest.spyOn(Subject, 'toStringArgs') | ||
|
||
beforeEach(() => { | ||
Subject.toString() | ||
}) | ||
|
||
it('should get string arguments', () => { | ||
expect(spy_toStringArgs).toBeCalledTimes(1) | ||
}) | ||
|
||
it('should join string arguments', () => { | ||
expect(mockJoin).toBeCalledTimes(1) | ||
expect(mockJoin).toBeCalledWith(Subject.toStringArgs(), ' ') | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.