Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Adding codegen config support for spm module type versions #539

Merged
merged 10 commits into from
Nov 27, 2024
603 changes: 603 additions & 0 deletions Tests/ApolloCodegenTests/ApolloCodegenConfigurationCodableTests.swift

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions Tests/ApolloCodegenTests/ApolloCodegenTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ class ApolloCodegenTests: XCTestCase {
operationSearchPaths: [operationsPath]
),
output: .mock(
moduleType: .swiftPackageManager,
moduleType: .swiftPackageManager(),
operations: .inSchemaModule,
path: directoryURL.path
)
Expand Down Expand Up @@ -756,7 +756,7 @@ class ApolloCodegenTests: XCTestCase {
operationSearchPaths: [operationsPath]
),
output: .mock(
moduleType: .swiftPackageManager,
moduleType: .swiftPackageManager(),
operations: .absolute(path: operationsOutputURL.path),
path: directoryURL.path
)
Expand Down Expand Up @@ -862,7 +862,7 @@ class ApolloCodegenTests: XCTestCase {
input: .init(schemaPath: schemaPath, operationSearchPaths: [operationsPath]),
output: .init(
schemaTypes: .init(path: directoryURL.path,
moduleType: .swiftPackageManager),
moduleType: .swiftPackageManager()),
BobaFetters marked this conversation as resolved.
Show resolved Hide resolved
operations: .inSchemaModule,
testMocks: .absolute(path: directoryURL.appendingPathComponent("TestMocks").path)
)
Expand Down Expand Up @@ -938,7 +938,7 @@ class ApolloCodegenTests: XCTestCase {
operationSearchPaths: [operationsPath]
),
output: .mock(
moduleType: .swiftPackageManager,
moduleType: .swiftPackageManager(),
operations: .inSchemaModule,
path: "./RelativePath"
)
Expand Down Expand Up @@ -1051,7 +1051,7 @@ class ApolloCodegenTests: XCTestCase {
operationSearchPaths: [operationsPath]
),
output: .mock(
moduleType: .swiftPackageManager,
moduleType: .swiftPackageManager(),
operations: .absolute(path: "./RelativeOperations"),
path: "./RelativePath"
)
Expand Down Expand Up @@ -1183,7 +1183,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackageManager()),
operations: .inSchemaModule
),
options: .init(pruneGeneratedFiles: false)
Expand Down Expand Up @@ -1241,7 +1241,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackageManager()),
operations: .inSchemaModule
)
)
Expand Down Expand Up @@ -1295,7 +1295,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackageManager()),
operations: .absolute(path: "OperationPath")
)
)
Expand Down Expand Up @@ -1364,7 +1364,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackageManager()),
operations: .relative(subpath: nil)
)
)
Expand Down Expand Up @@ -1437,7 +1437,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackageManager()),
operations: .relative(subpath: nil)
)
)
Expand Down Expand Up @@ -1489,7 +1489,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: schemaDirectory,
moduleType: .swiftPackageManager),
moduleType: .swiftPackageManager()),
operations: .relative(subpath: relativeSubPath)
),
options: .init(
Expand Down Expand Up @@ -1586,7 +1586,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackageManager()),
operations: .relative(subpath: "subpath")
)
)
Expand Down Expand Up @@ -1694,7 +1694,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackageManager()),
operations: .relative(subpath: "subpath")
)
)
Expand Down Expand Up @@ -1796,7 +1796,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackageManager()),
operations: .relative(subpath: "subpath")
)
)
Expand Down Expand Up @@ -1860,7 +1860,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackageManager()),
operations: .inSchemaModule,
testMocks: .absolute(path: absolutePath)
)
Expand Down Expand Up @@ -1917,7 +1917,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackageManager()),
testMocks: .swiftPackage()
)
)
Expand Down Expand Up @@ -1975,7 +1975,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackageManager()),
testMocks: .swiftPackage(targetName: testMockTargetName)
)
)
Expand Down Expand Up @@ -2285,7 +2285,7 @@ class ApolloCodegenTests: XCTestCase {
func test__validation__givenSchemaTypesModule_swiftPackageManager_withCocoapodsCompatibleImportStatements_true_shouldThrow() throws {
// given
let config = ApolloCodegenConfiguration.mock(
.swiftPackageManager,
.swiftPackageManager(),
options: .init(cocoapodsCompatibleImportStatements: true)
)

Expand All @@ -2301,7 +2301,7 @@ class ApolloCodegenTests: XCTestCase {
func test__validation__givenSchemaTypesModule_swiftPackageManager_withCocoapodsCompatibleImportStatements_false_shouldNotThrow() throws {
// given
let config = ApolloCodegenConfiguration.mock(
.swiftPackageManager,
.swiftPackageManager(),
options: .init(cocoapodsCompatibleImportStatements: false)
)

Expand Down Expand Up @@ -2387,7 +2387,7 @@ class ApolloCodegenTests: XCTestCase {
),
output: .init(
schemaTypes: .init(path: "SchemaModule",
moduleType: .swiftPackageManager),
moduleType: .swiftPackageManager()),
operations: .inSchemaModule
)
)
Expand Down Expand Up @@ -2538,7 +2538,7 @@ class ApolloCodegenTests: XCTestCase {
input: .init(schemaPath: schemaPath, operationSearchPaths: [operationsPath]),
output: .init(
schemaTypes: .init(path: directoryURL.path,
moduleType: .swiftPackageManager),
moduleType: .swiftPackageManager()),
operations: .inSchemaModule
),
options: .init(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FileGeneratorTests: XCTestCase {

private func buildConfig() {
let mockedConfig = ApolloCodegenConfiguration.mock(output: .mock(
moduleType: .swiftPackageManager,
moduleType: .swiftPackageManager(),
operations: .inSchemaModule
))

Expand Down
Loading
Loading