{"size": 1888, "ext": "js", "max_stars_repo_path": "tests/routes/routes.test.js", "max_stars_repo_name": "arturojschmidt/spTest", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "tests/routes/routes.test.js", "max_issues_repo_name": "arturojschmidt/spTest", "max_issues_repo_issues_event_min_datetime": "2020-09-07T19:24:49.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T21:16:02.000Z", "max_forks_repo_path": "tests/routes/routes.test.js", "max_forks_repo_name": "arturojschmidt/spTest", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 5, "max_forks_count": null, "avg_line_length": 30.4516129032, "max_line_length": 76, "alphanum_fraction": 0.5100635593}
const request = require('supertest')
const app = require('../../index')

describe('routes return statusCode 200', () => {
    test('/client GET method returns status 200', (done) => {
        request(app).get('/client').then((response) => {
            expect(response.statusCode).toBe(200);
            done();
        });
    });
    test('admin GET method returns status 200', (done) =>{
        request(app).get('/admin').then((response)=>{
            expect(response.statusCode).toBe(200)
            done()
        })
    })
  
});

describe("routes have Access-Control-Allow-Origin header set", ()=>{
    test('/client' , (done) =>{
        request(app).get('/client').then((response) =>{
            expect(response.header['access-control-allow-origin']).toBe('*')
            done()
        })
    })
    test('/admin' , (done) =>{
        request(app).get('/admin').then((response) =>{
            expect(response.header['access-control-allow-origin']).toBe('*')
            done()
        })
    })
    test('/auth/google' , (done) =>{
        request(app).get('/auth/google/login').then((response) =>{
            expect(response.header['access-control-allow-origin']).toBe('*')
            done()
        })
    })
    test('/auth/google/success' , (done) =>{
        request(app).get('/auth/google/success').then((response) =>{
            expect(response.header['access-control-allow-origin']).toBe('*')
            done()
        })
    })
    test('/auth/google/failed' , (done) =>{
        request(app).get('/auth/google/failed').then((response) =>{
            expect(response.header['access-control-allow-origin']).toBe('*')
            done()
        })
    })
    test('/' , (done) =>{
        request(app).get('/').then((response) =>{
            expect(response.header['access-control-allow-origin']).toBe('*')
            done()
        })
    })
    
    

})

