@@ -4,11 +4,12 @@ import { Technology } from '../../shared/models';
44import { TechnologyService } from './technology.service' ;
55import { STACK_EXCHANGE_ID , STACK_EXCHANGE_ACCESS_TOKEN } from '../../../../environments/environment' ;
66
7- describe ( 'TechnologyService' , ( ) => {
7+ fdescribe ( 'TechnologyService' , ( ) => {
88 let service : TechnologyService ;
99 let httpMock : HttpTestingController ;
1010
1111 const technologyList : Technology = { items : [ { name : 'java' } , { name : 'javascript' } ] } ;
12+ const technologyListWithSpecialChar : Technology = { items : [ { name : 'c#' } , { name : 'c#-2.0' } ] } ;
1213
1314 beforeEach ( ( ) => {
1415 TestBed . configureTestingModule ( {
@@ -42,4 +43,18 @@ describe('TechnologyService', () => {
4243 expect ( getTechnologiesRequest . request . method ) . toBe ( 'GET' ) ;
4344 getTechnologiesRequest . flush ( technologyList ) ;
4445 } ) ;
46+
47+ it ( 'technologies with special characters are read using GET from url' , ( ) => {
48+ const technologyFoundSize = technologyListWithSpecialChar . items . length ;
49+ const technologyName = 'c#' ;
50+ service . getTechnologies ( technologyName ) . subscribe ( ( technologyInResponse ) => {
51+ expect ( technologyInResponse . items . length ) . toBe ( technologyFoundSize ) ;
52+ } ) ;
53+ const getTechnologiesRequest = httpMock . expectOne (
54+ `${ service . baseUrl } &inname=${ encodeURIComponent ( technologyName ) } &site=stackoverflow&key=${ STACK_EXCHANGE_ID } &access_token=${ STACK_EXCHANGE_ACCESS_TOKEN } `
55+ ) ;
56+ expect ( getTechnologiesRequest . request . method ) . toBe ( 'GET' ) ;
57+ getTechnologiesRequest . flush ( technologyListWithSpecialChar ) ;
58+ } ) ;
59+
4560} ) ;
0 commit comments