| * Visit http://guide.xosproject.org/devguide/addview/ for more information |
| * Created by teone on 6/22/16. |
| describe('The Site Encoder service', () => { |
| let service, toscaBase, siteGetPromise, SiteSpy, rootScope; |
| const toscaBaseDefault = { |
| type: 'tosca.nodes.Site', |
| beforeEach(module('xos.serviceGrid')); |
| beforeEach(module('templates')); |
| beforeEach(inject((SiteEncoder, Sites, $q, $rootScope) => { |
| toscaBase = angular.copy(toscaBaseDefault); |
| siteGetPromise= $q.defer(); |
| spyOn(SiteSpy, 'get').and.callFake(function(){ |
| return {$promise: siteGetPromise.promise}; |
| describe('given a Site Id', () => { |
| it('should return the correct JSON structure', (done) => { |
| service.buildTosca({id: 1}, toscaBase) |
| expect(res).toEqual(expected); |
| siteGetPromise.resolve(siteResponse); |