import { async, ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import {HttpClient, HttpHeaders, HttpEventType, HttpClientModule} from '@angular/common/http';
// npm install git+https://github.com/Traktormaster/miscreant.js --save
import { CookieService } from 'ngx-cookie';
import { NanoService } from "./shared/nano/nano.service";


/**
 * 
 * NODEJS LOCAL SERVER TESTER
 * 
 */
/*
describe('Nano test', () => {

    let headers = {
        headers: new HttpHeaders({
          "Content-type": "application/json",
        })
    };
    let http: HttpClient;
    let apiUrl = environment.url_api+"/";
    let nanoService: NanoService;

   
    


    beforeAll(waitForAsync(()=>{
        TestBed.configureTestingModule({ 
            imports : [HttpClientModule],
            providers: [
                CookieService, 
                //NanoService,
            ]
        });

        http = TestBed.inject(HttpClient);
        //nanoService = TestBed.inject(NanoService);
        
        
    }));

    it('should run and reach the helper developer server', (done) => {

        http.get<any>(apiUrl+'', headers).toPromise().then((res)=>{
            expect('status' in res && res['status']===true).toBeTrue();
            done();
        });

    });

    
    it('should get server conf', (done) => {

        http.get<any>(apiUrl+'get-config', headers).toPromise().then((res)=>{
            expect('data' in res).toBeTrue();
            done();
        });

    });

    
    it('should work login', (done) => {

        http.post<any>(apiUrl+'do-login', {
            email: "user-0@clarabot.dev",
            password:"user-0-yes"
        }, headers).toPromise().then((res)=>{
            expect(true).toBeTrue();
            done();
        });

    });
    

    
    // it('should get diretory', (done)=>{
    //     nanoService.listDirectory("3kgqf3Q22322", "", (data)=>{
    //         console.log('directory list', data)
    //     })
    // })
    
    



    

});*/