-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vitaly Tomilov
committed
Mar 9, 2015
1 parent
c71c9ee
commit c292a70
Showing
1 changed file
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,45 @@ | ||
describe("Test", function () { | ||
it("test", function () { | ||
// TODO : Test codes will be written | ||
var pgpLib = require('../index') | ||
|
||
describe("Library Loading", function () { | ||
it("must be a function", function () { | ||
expect(typeof(pgpLib)).toBe('function'); | ||
}); | ||
}); | ||
|
||
var pgp = pgpLib(); | ||
|
||
describe("Library Instance Check", function () { | ||
it("must be a function", function () { | ||
expect(typeof(pgp)).toBe('function'); | ||
}); | ||
it("must have pg property", function () { | ||
expect(typeof(pgp.pg)).toBe('object'); | ||
}); | ||
it("must have as property", function () { | ||
expect(typeof(pgp.as)).toBe('object'); | ||
}); | ||
it("must have end function", function () { | ||
expect(typeof(pgp.end)).toBe('function'); | ||
}); | ||
}); | ||
|
||
describe("Query Result must be available", function () { | ||
it("must be an object", function () { | ||
expect(typeof(queryResult)).toBe('object'); | ||
}); | ||
it("must have all properties set correctly", function () { | ||
expect(queryResult.one === 1 && queryResult.many === 2 && queryResult.none === 4 && queryResult.any === 6).toBe(true); | ||
}); | ||
}); | ||
|
||
var db; | ||
|
||
describe("Database Instantiation", function () { | ||
it("must throw an error when no connection passed", function () { | ||
expect(pgp).toThrow("Invalid 'cn' parameter passed."); | ||
}); | ||
db = pgp("connection string"); | ||
it("must return a valid object", function () { | ||
expect(typeof(db)).toBe('object'); | ||
}); | ||
}); |