-
Notifications
You must be signed in to change notification settings - Fork 0
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
Write unit tests #4
Comments
Can you link any resource from where I can learn how to do this ? |
You can probably use mocha or jasmine framework to write unit tests. You'll need some library to make HTTP calls. You may use chai & chai-http for this purpose. You may find other good alternatives too but please discuss your tech stack before starting. Have a look at session_test.js for the sample test. It sets up the server and starts it. Then there is some commented code written for jasmine to test the application. There is some code in chai and chai-http which is used to make a call to the server. Instead of running the server, you can just test all the files in src folder for their functionality (pure unit tests). Here are some tutorials which I found using google;
All the best |
@amitguptagwl do you still need help with this? If so I'd like to take this one. |
@l0n3star yes, plz. check the coverage and go ahead. |
Do you mind if I use jest ?
…On Mon, Jul 8, 2019 at 5:28 PM Amit K Gupta ***@***.***> wrote:
@l0n3star <https://github.com/l0n3star> yes, plz. check the coverage and
go ahead.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4?email_source=notifications&email_token=ALAQO3ZZHNRWTVY7WUNEPXDP6PLSFA5CNFSM4FZJJX4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZOXHFI#issuecomment-509440917>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALAQO377FZKTDOMSCF6RYZDP6PLSFANCNFSM4FZJJX4A>
.
|
sure. jest is good. |
Guys, I wrote a unit test for the first one (cookies are sent to the
client). Using jest and supertest. Am I correct?
describe('auto-create: on', () => {
test('Cookies are sent to the client', (done) => {
request('http://localhost:3002')
.get('/login')
.then(res => {
expect(res["header"]["set-cookie"]).not.toBeUndefined();
done();
}).catch( error => {
done.fail(error);
});
});
});
…On Tue, Jul 9, 2019 at 5:42 PM Amit K Gupta ***@***.***> wrote:
sure. jest is good.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4?email_source=notifications&email_token=ALAQO3ZDV6477UIAZUTKK6DP6UV6HA5CNFSM4FZJJX4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZR6DBI#issuecomment-509862277>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALAQO33DY7YLWFIR2VRB2XDP6UV6HANCNFSM4FZJJX4A>
.
|
Following cases are tested manually. Need to write unit tests for auto-testing.
Scenarios
auto-create: on
auto-create: off
check session_test.js for more detail.
The text was updated successfully, but these errors were encountered: