Skip to content

WIP: Add integration tests#1285

Open
avelx wants to merge 5 commits into
mainfrom
Add_Integration_Tests
Open

WIP: Add integration tests#1285
avelx wants to merge 5 commits into
mainfrom
Add_Integration_Tests

Conversation

@avelx

@avelx avelx commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@yanns yanns left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the direction is good!

val result: Future[Any] = Executor
.execute(StarWarsSchema, query, new CharacterRepo, deferredResolver = new FriendsResolver)

result.map { x =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could return some json instead to make it more realistic.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change applied

Ok(s"ok:$x")
}
}
} No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: configure your text editor to always add a new line.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

next scalaFmt command applied:

sbt it/scalafmtAll

Comment thread it/test/query/StarWarsQueryISpec.scala Outdated
/*
Similar to the tests we have within => StarWarsQuerySpec but via controller
*/
class StarWarsQuerySpecISpec extends PlaySpec with Results {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid relying on PlaySpec (one more dependency to take care of), could we "just" write assertions on a function returning a Future[Json]?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand, you are ok with using Play as an environment, but just drop PlaySpec specifically?
yeh, we I can do this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggested approach applied;
Don't see much difference, but let it be this way

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd actually prefer not using Play as an environment to avoid adding more dependencies

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What surrounding environment would you suggest? as I understand its not worth to continue experimenting with the Test play controller ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can emulate an environment with a main function returning a Future[Json].

@avelx avelx Apr 21, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I've dropped Play dependency and use Future[String] to have more flexibility ;

so, now the only difference between StarWarsQuerySpecISpec and StarWarsQuerySpec is that we wrapped Executed within TestEnvironment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants