Permalink
Browse files

re-licensed FlyJSONP under MIT and GPLv3, and added a couple of test …

…cases
  • Loading branch information...
1 parent 332dea2 commit c37c5dc84c6222d00cd5af8beb7734c2c485fab1 @alotaiba committed Aug 20, 2011
Showing with 77 additions and 8 deletions.
  1. +35 −0 LICENSE
  2. +2 −2 flyjsonp.js
  3. +40 −6 test/test.js
View
35 LICENSE
@@ -1,3 +1,38 @@
+FlyJSONP is dual-licensed under MIT, and GPLv3.
+
+You may use FlyJSONP according to either of these licenses as is most
+appropriate for your project on a case-by-case basis.
+
+The text of all licenses are provided below.
+
+MIT License
+=========================
+
+Copyright (C) 2011 by Abdulrahman Saleh Khamis Al-Otaiba
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+
+
+GPLv3 License
+=========================
+
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
View
@@ -1,13 +1,13 @@
/*
- * FlyJSONP v0.1
+ * FlyJSONP v0.2
* http://alotaiba.github.com/FlyJSONP
*
* FlyJSONP is a small JavaScript library, that allows you to do
* cross-domain GET and POST requests with remote services that support
* JSONP, and get a JSON response.
*
* Copyright (c) 2011 Abdulrahman Al-Otaiba
- * Licensed under the GNU GPLv3
+ * Dual-licensed under MIT and GPLv3.
*/
var FlyJSONP = (function (global) {
View
@@ -5,11 +5,9 @@ test("FlyJSONP init", function() {
ok( FlyJSONP.options.debug, "Debug is turned on as expected." );
});
-test("FlyJSONP cross-domain GET with response", function() {
+asyncTest("FlyJSONP cross-domain GET with response", function() {
expect(1);
- stop();
-
FlyJSONP.get({
url: 'http://storify.com/xdamman.json',
success: function (data) {
@@ -24,11 +22,9 @@ test("FlyJSONP cross-domain GET with response", function() {
});
});
-test("FlyJSONP cross-domain POST with response", function() {
+asyncTest("FlyJSONP cross-domain POST with response", function() {
expect(1);
- stop();
-
FlyJSONP.post({
url: 'http://www.tumblr.com/api/write',
parameters: {
@@ -48,4 +44,42 @@ test("FlyJSONP cross-domain POST with response", function() {
start();
}
});
+});
+
+
+asyncTest("FlyJSONP cross-domain GET with invalid URL", function() {
+ expect(1);
+
+ FlyJSONP.get({
+ url: 'http://invalidurl',
+ success: function(data) {
+ ok( false, "Got valid reponse" );
+ },
+ error: function (errorMsg) {
+ ok( true, errorMsg );
+ },
+ complete: function () {
+ start();
+ }
+ });
+});
+
+asyncTest("FlyJSONP cross-domain POST with invalid URL", function() {
+ expect(1);
+
+ FlyJSONP.post({
+ url: 'http://invalidurl',
+ parameters: {
+ data: 'hello'
+ },
+ success: function(data) {
+ ok( false, "Got valid reponse" );
+ },
+ error: function (errorMsg) {
+ ok( true, errorMsg );
+ },
+ complete: function () {
+ start();
+ }
+ });
});

0 comments on commit c37c5dc

Please sign in to comment.