**HELLO EVERYONE; I am trying to use unit test locally for my project and I 
am kind of stuck and I need some examples or any good tutorials if that 
will help. I am using angular 2 with *sequelizeJS* and an sql database and 
for testing enviroment i am using *GULP *as a test runner and *JASMINE* as 
a test framework ** Endpoint.ts file

if someone can show me how to test this sample of the code it will help me 
a lot to understand how to write unit tests


[[    country(request: any, response: any, next: any) {
    let query: any = url.parse(request.url, true).query;
    let region = decodeURI(query.region);

    let carDataType = decodeURI(query.carDataType);
    let aggregatedResult = null;
    if (carDataType.toLowerCase().indexOf('sales') >= 0) {
        aggregatedResult = Sales.aggregate('country', 'DISTINCT', {plain: 
false, where: {region: region}});
    } else {
        aggregatedResult = Production.aggregate('country', 'DISTINCT', {plain: 
false, where: {region: region}});
    }

    aggregatedResult.map(res => {
        return res['DISTINCT']
    }).then((suggestion: any) => {
        console.log(suggestion);
        response.send(suggestion);
    }).catch(error => {
        response.status(500).send(error);
        next(error);
    });}]]

Any one that can help me?

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to