-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from riiid/feature/spec-file
Create xctemplate for spec files using Quick and Nimble
- Loading branch information
Showing
7 changed files
with
186 additions
and
43 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,47 @@ | ||
<p align="center"> | ||
<img src="https://user-images.githubusercontent.com/1744446/106479190-62a5ec80-64ed-11eb-8446-07d2a782af37.png" width=256/> | ||
</p> | ||
|
||
# XCTemplate for testing [TCA] feature using [Quick] | ||
|
||
> Generates [TCA] components using XCTemplate | ||
* Components | ||
* Spec | ||
|
||
## How to install | ||
|
||
```sh | ||
❯ git clone [email protected]:riiid/xctemplate-for-tca.git | ||
❯ cd xctemplate-for-tca | ||
❯ make | ||
``` | ||
|
||
## Usage | ||
|
||
1. Create a new group | ||
|
||
![image](https://user-images.githubusercontent.com/46320390/224585557-0c411e9f-0025-4636-a73b-52b9262b516c.png) | ||
|
||
2. <kbd>Command ⌘</kbd> + <kbd>N</kbd> <sub>or `File ❯ New ❯ File...`</sub> in the group | ||
3. Select `Swift files for TCA` | ||
4. <kbd>Next</kbd> | ||
|
||
![image](https://user-images.githubusercontent.com/46320390/224587643-ba5ce047-9f57-45f3-966b-e379751638c0.png) | ||
|
||
5. Set a core<sub>module</sub> name that you want to test | ||
6. <kbd>Next</kbd> | ||
|
||
![image](https://user-images.githubusercontent.com/46320390/224587275-74108a55-f0aa-43f5-b712-1cfa552928a4.png) | ||
|
||
7. <kbd>Create</kbd> spec file in the group | ||
|
||
![image](https://user-images.githubusercontent.com/46320390/224264191-722281ff-630c-4e78-a30c-3a28501114ef.png) | ||
|
||
|
||
8. :tada: Your turn from here! | ||
|
||
![image](https://user-images.githubusercontent.com/46320390/224587315-ee587318-7f60-4264-b878-6aaa8ba832a1.png) | ||
|
||
[TCA]: https://github.com/pointfreeco/swift-composable-architecture | ||
[Quick]: https://github.com/Quick/Quick |
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 |
---|---|---|
|
@@ -2,50 +2,11 @@ | |
<img src="https://user-images.githubusercontent.com/1744446/106479190-62a5ec80-64ed-11eb-8446-07d2a782af37.png" width=256/> | ||
</p> | ||
|
||
# XCTemplate for [TCA] | ||
# XCTemplates for [TCA] related features | ||
|
||
> Generates [TCA] components using XCTemplate | ||
* Components | ||
* Action | ||
* Environment | ||
* Reducer | ||
* State | ||
* View(with Store) | ||
|
||
## How to install | ||
|
||
```sh | ||
❯ git clone [email protected]:riiid/xctemplate-for-tca.git | ||
❯ cd xctemplate-for-tca | ||
❯ make | ||
``` | ||
|
||
## Usage | ||
|
||
1. Create a new group | ||
|
||
![image](https://user-images.githubusercontent.com/1744446/106472348-ee1b7f80-64e5-11eb-8ab1-717b9e386e4b.png) | ||
|
||
2. <kbd>Command ⌘</kbd> + <kbd>N</kbd> <sub>or `File ❯ New ❯ File...`</sub> in the group | ||
3. Select `Swift files for TCA` | ||
4. <kbd>Next</kbd> | ||
|
||
![image](https://user-images.githubusercontent.com/1744446/106472373-f4a9f700-64e5-11eb-80cf-6263fb794af2.png) | ||
|
||
5. Set a core<sub>module</sub> name that you want | ||
6. <kbd>Next</kbd> | ||
|
||
![image](https://user-images.githubusercontent.com/1744446/106472392-f96eab00-64e5-11eb-9a5f-1b81f0bd5737.png) | ||
|
||
7. <kbd>Create</kbd> files in the group | ||
|
||
![image](https://user-images.githubusercontent.com/1744446/106472410-fd9ac880-64e5-11eb-8a2c-9f22ab66a5da.png) | ||
|
||
8. :tada: Your turn from here! | ||
|
||
![image](https://user-images.githubusercontent.com/1744446/106477357-6b95be80-64eb-11eb-9e23-1c6ab7802767.png) | ||
## List of templates | ||
|
||
* [TCA feature](https://github.com/riiid/xctemplate-for-tca/blob/main/tca_knowhow.md) | ||
* [Spec for TCA feature](https://github.com/riiid/xctemplate-for-tca/blob/main/Quick_knowhow.md) | ||
|
||
[TCA]: https://github.com/pointfreeco/swift-composable-architecture | ||
|
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,52 @@ | ||
<p align="center"> | ||
<img src="https://user-images.githubusercontent.com/1744446/106479190-62a5ec80-64ed-11eb-8446-07d2a782af37.png" width=256/> | ||
</p> | ||
|
||
# XCTemplate for [TCA] | ||
|
||
> Generates [TCA] components using XCTemplate | ||
* Components | ||
* Action | ||
* Environment | ||
* Reducer | ||
* State | ||
* View(with Store) | ||
|
||
## How to install | ||
|
||
```sh | ||
❯ git clone [email protected]:riiid/xctemplate-for-tca.git | ||
❯ cd xctemplate-for-tca | ||
❯ make | ||
``` | ||
|
||
## Usage | ||
|
||
1. Create a new group | ||
|
||
![image](https://user-images.githubusercontent.com/1744446/106472348-ee1b7f80-64e5-11eb-8ab1-717b9e386e4b.png) | ||
|
||
2. <kbd>Command ⌘</kbd> + <kbd>N</kbd> <sub>or `File ❯ New ❯ File...`</sub> in the group | ||
3. Select `Swift files for TCA` | ||
4. <kbd>Next</kbd> | ||
|
||
![image](https://user-images.githubusercontent.com/1744446/106472373-f4a9f700-64e5-11eb-80cf-6263fb794af2.png) | ||
|
||
5. Set a core<sub>module</sub> name that you want | ||
6. <kbd>Next</kbd> | ||
|
||
![image](https://user-images.githubusercontent.com/1744446/106472392-f96eab00-64e5-11eb-9a5f-1b81f0bd5737.png) | ||
|
||
7. <kbd>Create</kbd> files in the group | ||
|
||
![image](https://user-images.githubusercontent.com/1744446/106472410-fd9ac880-64e5-11eb-8a2c-9f22ab66a5da.png) | ||
|
||
8. :tada: Your turn from here! | ||
|
||
![image](https://user-images.githubusercontent.com/1744446/106477357-6b95be80-64eb-11eb-9e23-1c6ab7802767.png) | ||
|
||
|
||
[TCA]: https://github.com/pointfreeco/swift-composable-architecture | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,39 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>SupportsSwiftPackage</key> | ||
<true/> | ||
<key>Kind</key> | ||
<string>Xcode.IDEFoundation.TextSubstitutionFileTemplateKind</string> | ||
<key>SortOrder</key> | ||
<string>1</string> | ||
<key>AllowedTypes</key> | ||
<array> | ||
<string>public.swift-source</string> | ||
</array> | ||
<key>Platforms</key> | ||
<array/> | ||
<key>DefaultCompletionName</key> | ||
<string>YourApp</string> | ||
<key>Options</key> | ||
<array> | ||
<dict> | ||
<key>Identifier</key> | ||
<string>productName</string> | ||
<key>Required</key> | ||
<true/> | ||
<key>Name</key> | ||
<string>Feature Name: </string> | ||
<key>Description</key> | ||
<string>The name of a feature which needs spec file</string> | ||
<key>Type</key> | ||
<string>text</string> | ||
<key>Default</key> | ||
<string>Your feature</string> | ||
<key>NotPersisted</key> | ||
<true/> | ||
</dict> | ||
</array> | ||
</dict> | ||
</plist> |
44 changes: 44 additions & 0 deletions
44
templates/Spec File for TCA.xctemplate/___FILEBASENAME___Spec.swift
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 @@ | ||
//___FILEHEADER___ | ||
|
||
import ComposableArchitecture | ||
import Foundation | ||
import Nimble | ||
import Quick | ||
|
||
@testable import ___VARIABLE_productName:identifier___ | ||
|
||
typealias Test___VARIABLE_productName:identifier___Store = TestStore< | ||
___VARIABLE_productName:identifier___.State, | ||
___VARIABLE_productName:identifier___.Action, | ||
___VARIABLE_productName:identifier___.State, | ||
___VARIABLE_productName:identifier___.Action, | ||
Void | ||
> | ||
|
||
final class ___FILEBASENAMEASIDENTIFIER___: QuickSpec { | ||
private let scheduler: TestSchedulerOf<DispatchQueue> = DispatchQueue.test | ||
|
||
private func getSut() -> Test___VARIABLE_productName:identifier___Store { | ||
var sut: Test___VARIABLE_productName:identifier___Store | ||
sut = .init( | ||
initialState: .init(), | ||
reducer: ___VARIABLE_productName:identifier___() | ||
) | ||
sut.exhaustivity = .off | ||
|
||
// set mock environment here | ||
|
||
return sut | ||
} | ||
|
||
override func spec() { | ||
describe("___VARIABLE_productName:identifier___") { | ||
var sut: Test___VARIABLE_productName:identifier___Store | ||
sut = self.getSut() | ||
|
||
context("When") { | ||
it("should do") {} | ||
} | ||
} | ||
} | ||
} |