Skip to content

Commit

Permalink
Merge pull request #3 from ishkawa/test-demo
Browse files Browse the repository at this point in the history
 Add testing demo
  • Loading branch information
ishkawa authored Sep 5, 2018
2 parents 5fbfad4 + 86b1d22 commit b2d1dcc
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 38 deletions.
18 changes: 14 additions & 4 deletions DataSourceKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
7F9AEDAD213BBBA10092854F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F9AEDAC213BBBA10092854F /* AppDelegate.swift */; };
7F9AEDB4213BBBA30092854F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7F9AEDB3213BBBA30092854F /* Assets.xcassets */; };
7F9AEDB7213BBBA30092854F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7F9AEDB5213BBBA30092854F /* LaunchScreen.storyboard */; };
7F9AEDC2213BBBA30092854F /* DemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F9AEDC1213BBBA30092854F /* DemoTests.swift */; };
7F9AEDCF213BBC280092854F /* CollectionViewFullWidthCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F9AEDCC213BBC280092854F /* CollectionViewFullWidthCell.swift */; };
7F9AEDDE213BBC390092854F /* Review.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F9AEDD1213BBC390092854F /* Review.swift */; };
7F9AEDDF213BBC390092854F /* Venue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F9AEDD2213BBC390092854F /* Venue.swift */; };
Expand Down Expand Up @@ -47,6 +46,8 @@
7FC38D31213FA8BC009FCEB1 /* BTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FC38D30213FA8BC009FCEB1 /* BTableViewCell.swift */; };
7FC38D33213FA908009FCEB1 /* TableViewDataSourceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FC38D32213FA908009FCEB1 /* TableViewDataSourceTests.swift */; };
7FC38D35213FA917009FCEB1 /* TestTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FC38D34213FA917009FCEB1 /* TestTableView.swift */; };
7FC38D39213FAC69009FCEB1 /* VenuDetailViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FC38D38213FAC69009FCEB1 /* VenuDetailViewControllerTests.swift */; };
7FC38D3B213FACE8009FCEB1 /* DataSourceKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7FB64BF6213B552B0071FC26 /* DataSourceKit.framework */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -95,7 +96,6 @@
7F9AEDB6213BBBA30092854F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
7F9AEDB8213BBBA30092854F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
7F9AEDBD213BBBA30092854F /* DemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
7F9AEDC1213BBBA30092854F /* DemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoTests.swift; sourceTree = "<group>"; };
7F9AEDC3213BBBA30092854F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
7F9AEDCC213BBC280092854F /* CollectionViewFullWidthCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewFullWidthCell.swift; sourceTree = "<group>"; };
7F9AEDD1213BBC390092854F /* Review.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Review.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -133,6 +133,7 @@
7FC38D30213FA8BC009FCEB1 /* BTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTableViewCell.swift; sourceTree = "<group>"; };
7FC38D32213FA908009FCEB1 /* TableViewDataSourceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewDataSourceTests.swift; sourceTree = "<group>"; };
7FC38D34213FA917009FCEB1 /* TestTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestTableView.swift; sourceTree = "<group>"; };
7FC38D38213FAC69009FCEB1 /* VenuDetailViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VenuDetailViewControllerTests.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -148,6 +149,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
7FC38D3B213FACE8009FCEB1 /* DataSourceKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -186,7 +188,7 @@
7F9AEDC0213BBBA30092854F /* DemoTests */ = {
isa = PBXGroup;
children = (
7F9AEDC1213BBBA30092854F /* DemoTests.swift */,
7FC38D38213FAC69009FCEB1 /* VenuDetailViewControllerTests.swift */,
7F9AEDC3213BBBA30092854F /* Info.plist */,
);
path = DemoTests;
Expand Down Expand Up @@ -234,6 +236,7 @@
7F9AEDAB213BBBA10092854F /* Demo */,
7F9AEDC0213BBBA30092854F /* DemoTests */,
7FB64BF7213B552B0071FC26 /* Products */,
7FC38D3A213FACE8009FCEB1 /* Frameworks */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -300,6 +303,13 @@
path = TestView;
sourceTree = "<group>";
};
7FC38D3A213FACE8009FCEB1 /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
Expand Down Expand Up @@ -497,7 +507,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7F9AEDC2213BBBA30092854F /* DemoTests.swift in Sources */,
7FC38D39213FAC69009FCEB1 /* VenuDetailViewControllerTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
101 changes: 101 additions & 0 deletions DataSourceKit.xcodeproj/xcshareddata/xcschemes/Demo.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7F9AEDA9213BBBA10092854F"
BuildableName = "Demo.app"
BlueprintName = "Demo"
ReferencedContainer = "container:DataSourceKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7F9AEDBC213BBBA30092854F"
BuildableName = "DemoTests.xctest"
BlueprintName = "DemoTests"
ReferencedContainer = "container:DataSourceKit.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7F9AEDA9213BBBA10092854F"
BuildableName = "Demo.app"
BlueprintName = "Demo"
ReferencedContainer = "container:DataSourceKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7F9AEDA9213BBBA10092854F"
BuildableName = "Demo.app"
BlueprintName = "Demo"
ReferencedContainer = "container:DataSourceKit.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7F9AEDA9213BBBA10092854F"
BuildableName = "Demo.app"
BlueprintName = "Demo"
ReferencedContainer = "container:DataSourceKit.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
34 changes: 0 additions & 34 deletions DemoTests/DemoTests.swift

This file was deleted.

33 changes: 33 additions & 0 deletions DemoTests/VenuDetailViewControllerTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// VenuDetailViewControllerTests.swift
// DemoTests
//
// Created by Yosuke Ishikawa on 2018/09/05.
// Copyright © 2018年 Yosuke Ishikawa. All rights reserved.
//

import XCTest
@testable import Demo

class VenuDetailViewControllerTests: XCTestCase {
func testEmptyRelatedVenues() {
let venue = Venue(photo: nil, name: "Kaminarimon")
let review1 = Review(authorImage: nil, authorName: "Yosuke Ishikawa", body: "Foo")
let review2 = Review(authorImage: nil, authorName: "Masatake Yamoto", body: "Bar")

let data = VenueDetailViewController.Data(
venue: venue,
reviews: [
review1,
review2,
],
relatedVenues: [])

XCTAssertEqual(data.cellDeclarations, [
.outline(venue),
.sectionHeader("Reviews"),
.review(review1),
.review(review2),
])
}
}

0 comments on commit b2d1dcc

Please sign in to comment.