Changeset 19:ab5f65372038 in pyenvjasmine for pyenvjasmine/envjasmine/specs


Ignore:
Timestamp:
Apr 24, 2015, 1:03:31 PM (9 years ago)
Author:
Borja Lopez <borja@…>
Branch:
default
Phase:
public
Message:

Imported latest envjasmine version, the initial import from darcs had the wrong version

Location:
pyenvjasmine/envjasmine/specs
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • pyenvjasmine/envjasmine/specs/ajaxDemo.spec.js

    r0 r19  
    1 // Load the file to test here.
    2 //
    3 // Example:
    41EnvJasmine.load(EnvJasmine.jsDir + "ajaxDemo.js");
    52
    6 // This is the test code.
    7 describe("AjaxDemo", function () {
    8     it("calls the addDataToDOM function on success", function () {
    9         TwitterWidget.makeRequest(); // Make the AJAX call
    10 
    11         spyOn(TwitterWidget, "addDataToDOM"); // Add a spy to the callback
    12 
    13         mostRecentAjaxRequest().response({status: 200, responseText: "foo"}); // Mock the response
    14 
    15         expect(TwitterWidget.addDataToDOM).toHaveBeenCalledWith("foo");
     3describe('greetUser', function () {
     4    it('calls greeter on success', function () {
     5        NS.greetUser(1);
     6        spyOn(NS, 'greeter');
     7        mostRecentAjaxRequest().response({
     8            status: 200,
     9            responseText: {"name":"Trevor"}
     10        });
     11        expect(NS.greeter).toHaveBeenCalledWith('Trevor');
    1612    });
    1713});
  • pyenvjasmine/envjasmine/specs/demo.spec.js

    r0 r19  
    1 // Load the file to test here.
    2 //
    3 // Example:
    41EnvJasmine.load(EnvJasmine.jsDir + "demo.js");
    52
    6 // Load mocks for this spec
    7 EnvJasmine.load(EnvJasmine.mocksDir + "demo.mock.js");
    8 
    9 describe("Demo", function () {
    10     it("asserts that one plus one equals two", function () {
    11         expect(1 + 1 == 2).toEqual(true);
    12     });
    13 
    14     it("asserts that 1 + 1 does not equal 3", function () {
    15         expect(1 + 1 == 3).toEqual(false);
    16     });
    17 
    18     it("asserts that a user has a birthdate", function () {
    19         expect(Demo.checkBirthdate(demoUser)).toEqual(true);
    20     });
    21 
    22     it("asserts that an ill-formed user has no birthdate", function () {
    23         expect(Demo.checkBirthdate(badUser)).toEqual(false);
     3describe('greeter', function () {
     4    it('greets me', function () {
     5        expect(NS.greeter('Trevor')).toEqual('Hello Trevor!');
    246    });
    257});
Note: See TracChangeset for help on using the changeset viewer.