Is my JavaScript test actually testing anything worthwhile here Given a production module like this:

function ($) {
   var 
    showForm = function () {
        $.get(url, function (html) {          
            $('body').append(html);
        });
    };

   return {
       showForm: showForm
   };
});


I have written the following unit test:

it("calling showForm appends html to existing page", function () {

    var testPage = $('&lt;div&gt;&lt;body&gt;&lt;span&gt;&lt;/span&gt;&lt;/body&gt;&lt;/div&gt;');
    var expectedPage = $('&lt;div&gt;&lt;body&gt;&lt;span&gt;&lt;/span&gt;&lt;label&gt;&lt;/label&gt;&lt;/body&gt;&lt;/div&gt;');
    var htmlToAppend = $('&lt;label&gt;&lt;/label&gt;');

    var callback = function () { return testPage.append(htmlToAppend); }


    sinon.stub(presenter, "showForm").yields(testPage); 

    presenter.showForm(callback);

    expect(testPage.html()).to.equal(expectedPage.html());
});


I am trying to test that when presenter.showForm is called, the returned html is appended successfully appended.  Problem is, I'm not usre if it's a valid test as pretty much everything is fake.

I'm toying with the idea of abstracting out the call to $('body').append(html); to another public function of the module or perhaps even to another module so that 
the call presenter.showForm(callback); can use the real function but I'm not sure?

I hope that all makes sense.

Can someone review and advise please?
I'm not quite sure what you mean by "abstracting out the call...", but given that the "production module" actually looks like that, then I'd say that you have a perfectly valid little test there.

It is good to hear that you really are interested in making sure that your test cases are testing the right things. Unit tests are too often something that programmers write simply because they are forced to do it, and they are therefore happy enough when the tests don't fail - not pausing to consider that it might have passed because the test was incorrect, tested the wrong criteria, or did not in fact test anything at all.

Using fake data is what you normally do at this level of functionality, so you are good there. You might generally want to consider using more than one set of test data, but in this case I would say that it is not necessary.