From 63a7837ba50052e04c487e5ab94010342f97f9e6 Mon Sep 17 00:00:00 2001 From: fredkingham Date: Sat, 25 Feb 2017 12:32:23 +0000 Subject: [PATCH] remove the old services test and use the extract schema loader --- ...js => extractSchemaLoader.service.test.js} | 56 ++----------------- 1 file changed, 5 insertions(+), 51 deletions(-) rename opal/static/js/test/{servicesTest.js => extractSchemaLoader.service.test.js} (60%) diff --git a/opal/static/js/test/servicesTest.js b/opal/static/js/test/extractSchemaLoader.service.test.js similarity index 60% rename from opal/static/js/test/servicesTest.js rename to opal/static/js/test/extractSchemaLoader.service.test.js index 18934bab9..ef9616ad8 100644 --- a/opal/static/js/test/servicesTest.js +++ b/opal/static/js/test/extractSchemaLoader.service.test.js @@ -2,7 +2,7 @@ describe('services', function() { "use strict"; var $httpBackend, $q, $rootScope; - var columns, episodeData, records, list_schema, mockWindow; + var columns, $window; var profile = { readonly : false, @@ -35,67 +35,21 @@ describe('services', function() { } } }; - - records = columns.fields; - - episodeData = { - id: 123, - date_of_admission: "19/11/2013", - active: true, - discharge_date: null, - date_of_episode: null, - tagging: [{ - mine: true, - tropical: true - }], - demographics: [{ - id: 101, - first_name: 'John', - surname: 'Smith', - date_of_birth: '31/071980', - hospital_number: '555' - }], - location: [{ - category: 'Inepisode', - hospital: 'UCH', - ward: 'T10', - bed: '15', - date_of_admission: '01/08/2013', - }], - diagnosis: [{ - id: 102, - condition: 'Dengue', - provisional: true, - date_of_diagnosis: '20/04/2007' - }, { - id: 103, - condition: 'Malaria', - provisional: false, - date_of_diagnosis: '19/03/2006' - }] - }; }); describe('extractSchemaLoader', function(){ var mock, extractSchemaLoader; beforeEach(function(){ - mock = { alert: jasmine.createSpy() }; - - module(function($provide) { - $provide.value('$window', mock); - }); - - module('opal.services', function($provide) { - $provide.value('UserProfile', function(){ return profile; }); - }); - inject(function($injector){ extractSchemaLoader = $injector.get('extractSchemaLoader'); $httpBackend = $injector.get('$httpBackend'); $rootScope = $injector.get('$rootScope'); $q = $injector.get('$q'); + $window = $injector.get('$window'); }); + + spyOn($window, "alert"); }); it('should fetch the schema', function(){ @@ -118,7 +72,7 @@ describe('services', function() { $rootScope.$apply(); $httpBackend.flush(); - expect(mock.alert).toHaveBeenCalledWith( + expect($window.alert).toHaveBeenCalledWith( 'Extract schema could not be loaded'); }); });