diff --git a/spec/barcodescanner.tests.js b/spec/barcodescanner.tests.js index ccc351bb..fd0dbdff 100644 --- a/spec/barcodescanner.tests.js +++ b/spec/barcodescanner.tests.js @@ -19,52 +19,23 @@ * */ -describe('Camera (navigator.camera)', function () { +describe('Plugin object (window.plugins)', function () { it("should exist", function() { - expect(navigator.camera).toBeDefined(); + expect(window.plugins).toBeDefined(); }); - it("should contain a getPicture function", function() { - expect(navigator.camera.getPicture).toBeDefined(); - expect(typeof navigator.camera.getPicture == 'function').toBe(true); + it("should contain a barcodeScanner object", function() { + expect(window.plugins.barcodeScanner).toBeDefined(); + expect(typeof window.plugins.barcodeScanner == 'object').toBe(true); }); -}); - -describe('Camera Constants (window.Camera + navigator.camera)', function () { - it("window.Camera should exist", function() { - expect(window.Camera).toBeDefined(); - }); - it("should contain three DestinationType constants", function() { - expect(Camera.DestinationType.DATA_URL).toBe(0); - expect(Camera.DestinationType.FILE_URI).toBe(1); - expect(Camera.DestinationType.NATIVE_URI).toBe(2); - expect(navigator.camera.DestinationType.DATA_URL).toBe(0); - expect(navigator.camera.DestinationType.FILE_URI).toBe(1); - expect(navigator.camera.DestinationType.NATIVE_URI).toBe(2); + it("should contain a scan function", function() { + expect(window.plugins.barcodeScanner.scan).toBeDefined(); + expect(typeof window.plugins.barcodeScanner.scan == 'function').toBe(true); }); - it("should contain two EncodingType constants", function() { - expect(Camera.EncodingType.JPEG).toBe(0); - expect(Camera.EncodingType.PNG).toBe(1); - expect(navigator.camera.EncodingType.JPEG).toBe(0); - expect(navigator.camera.EncodingType.PNG).toBe(1); - }); - - it("should contain three MediaType constants", function() { - expect(Camera.MediaType.PICTURE).toBe(0); - expect(Camera.MediaType.VIDEO).toBe(1); - expect(Camera.MediaType.ALLMEDIA).toBe(2); - expect(navigator.camera.MediaType.PICTURE).toBe(0); - expect(navigator.camera.MediaType.VIDEO).toBe(1); - expect(navigator.camera.MediaType.ALLMEDIA).toBe(2); - }); - it("should contain three PictureSourceType constants", function() { - expect(Camera.PictureSourceType.PHOTOLIBRARY).toBe(0); - expect(Camera.PictureSourceType.CAMERA).toBe(1); - expect(Camera.PictureSourceType.SAVEDPHOTOALBUM).toBe(2); - expect(navigator.camera.PictureSourceType.PHOTOLIBRARY).toBe(0); - expect(navigator.camera.PictureSourceType.CAMERA).toBe(1); - expect(navigator.camera.PictureSourceType.SAVEDPHOTOALBUM).toBe(2); + it("should contain an encode function", function() { + expect(window.plugins.barcodeScanner.encode).toBeDefined(); + expect(typeof window.plugins.barcodeScanner.encode == 'function').toBe(true); }); });