Skip to content

Commit

Permalink
Update tests and change log
Browse files Browse the repository at this point in the history
  • Loading branch information
dangthaison91 committed May 16, 2019
1 parent 70c138f commit c55d7c4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -10,6 +10,7 @@ Please, check out guidelines: https://keepachangelog.com/en/1.0.0/

- Adding generate command timer https://github.com/tuist/tuist/pull/335 by @kwridan
- Support Scheme manifest with pre/post action https://github.com/tuist/tuist/pull/336 by @dangthaison91
- Support local Scheme (not shared) flag https://github.com/tuist/tuist/pull/341 by @dangthaison91

### Removed

Expand Down
31 changes: 27 additions & 4 deletions Tests/TuistGeneratorTests/Generator/ProjectGeneratorTests.swift
Expand Up @@ -52,10 +52,9 @@ final class ProjectGeneratorTests: XCTestCase {
// Given
let target = Target.test(name: "Target", platform: .iOS, product: .framework)
let sharedScheme = Scheme.test(name: "Target-Scheme", shared: true, buildAction: BuildAction(targets: ["Target"]))
let localScheme = Scheme.test(name: "Target-Local", shared: false, buildAction: BuildAction(targets: ["Target"]))

let targets = [target]
let project = Project.test(path: fileHandler.currentPath, name: "Project", targets: targets, schemes: [sharedScheme, localScheme])
let project = Project.test(path: fileHandler.currentPath, name: "Project", targets: targets, schemes: [sharedScheme])
try fileHandler.touch(fileHandler.currentPath.appending(component: "Project.swift"))

let cache = GraphLoaderCache()
Expand All @@ -73,9 +72,33 @@ final class ProjectGeneratorTests: XCTestCase {

// Then
let schemesPath = got.path.appending(RelativePath("xcshareddata/xcschemes"))
let scheme = schemesPath.appending(component: "Target-Scheme.xcscheme")
XCTAssertTrue(fileHandler.exists(scheme))
let targetScheme = schemesPath.appending(component: "Target-Scheme.xcscheme")
XCTAssertTrue(fileHandler.exists(targetScheme))
}

func test_generate_local_scheme() throws {
// Given
let target = Target.test(name: "Target", platform: .iOS, product: .framework)
let localScheme = Scheme.test(name: "Target-Local", shared: false, buildAction: BuildAction(targets: ["Target"]))

let targets = [target]
let project = Project.test(path: fileHandler.currentPath, name: "Project", targets: targets, schemes: [localScheme])
try fileHandler.touch(fileHandler.currentPath.appending(component: "Project.swift"))

let cache = GraphLoaderCache()
cache.add(project: project)
let graph = Graph.test(entryPath: fileHandler.currentPath,
cache: cache,
entryNodes: [TargetNode(project: project,
target: target,
dependencies: [])])

// When
let got = try subject.generate(project: project,
options: GenerationOptions(),
graph: graph)

// Then
let username = NSUserName()
let userSchemesPath = got.path.appending(RelativePath("xcuserdata/\(username).xcuserdatad/xcschemes"))
let userScheme = userSchemesPath.appending(component: "Target-Local.xcscheme")
Expand Down

0 comments on commit c55d7c4

Please sign in to comment.