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

Testing the server side code #59

Closed
jonatanskogsfors opened this issue May 22, 2017 · 6 comments
Closed

Testing the server side code #59

jonatanskogsfors opened this issue May 22, 2017 · 6 comments

Comments

@jonatanskogsfors
Copy link

I'm interested in a way to test the server side code.

I have a more complex project started from this repo and there is essential logic in the server controllers that I really would like to have tests for.

I've experimented some with using mocha but then I get name collisions with jasmine identifiers. I would be nice to have jasmine all the way but I have not gotten that to work (yet).

@zbagley
Copy link
Contributor

zbagley commented May 23, 2017

Jasmine is already included in this repo, so there's no need to be using mocha. If you're looking to implement mocha, then you'll want to remove jasmine. Go ahead and check out Jasmine vs. Mocha on google to find several good reads on how they are competing test tools.

@jonatanskogsfors
Copy link
Author

jonatanskogsfors commented May 24, 2017

Yes, I would prefer to only use one framework. My dabbling with mocha was primarily because I couldn't get jasmine to work on both client and server. And that is te actual question: How should I test the server code?

I would love for this project to include examples of this.

@zbagley
Copy link
Contributor

zbagley commented May 24, 2017

Karma + Jasmine is the framework set up for live BDD/TDD. There's quite a few tutorials out there. In this repo all you need to do is type ng test for a basic Karma/Jasmine test.

@jonatanskogsfors
Copy link
Author

ng test is all you have to do for client side testing (ng as in Angular) and it's working perfect out of the box. Server side testing however is only performed secondarily by the e2e-tests.

The server code in this project is maybe not worth testing since most logic in handled by mongoose so to showcase server testing there should probably be more server logic.

There is a jungle of tutorials for jasmine but I have not yet found a good one that works with both typescript and nodejs.

There is the module jasmine-node-karma on npm but then you are restricted to jasmine 1.3.1.

@zbagley
Copy link
Contributor

zbagley commented May 24, 2017

I'll be working closely with this over the next day or so, and I have a few solid tutorials saved already... but I'll update with the best or what I used. I'm shifting to testing both client and server with Karma + Jasmine.

@zbagley
Copy link
Contributor

zbagley commented May 26, 2017

Just wanted to mention that our server tests are postponed until next week while we work some bugs out, but I haven't forgot.

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

No branches or pull requests

2 participants