~ya-bo-ng/juju-gui/bottom-bar-removed

« back to all changes in this revision

Viewing changes to test/test_model.js

  • Committer: Benjamin Saller
  • Date: 2012-07-24 15:13:14 UTC
  • Revision ID: bcsaller@gmail.com-20120724151314-fbp6t4acbgeg7twu
Includings basic router

A simple test setup using YUI and Mocha together, seems easily viable.

A Makefile to install, test and run the server.js

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
var path = require("path"),
 
2
    YUI = require("yui").YUI;
 
3
 
 
4
(function () {
 
5
    
 
6
describe("juju models", function() {
 
7
    var Y, models;
 
8
 
 
9
    before(function (done) {
 
10
        Y = YUI({
 
11
        modules: {
 
12
            'juju-models': {
 
13
                requires: ["model", "model-list"],
 
14
                fullpath: path.join(
 
15
                    __dirname, 
 
16
                    '../app/assets/javascripts/models/models.js')
 
17
            }
 
18
        }
 
19
        }).use("base", "juju-models", function (Y) {
 
20
            models = Y.namespace("juju.models");
 
21
            done();
 
22
        });
 
23
    });
 
24
 
 
25
 
 
26
    it("must be able to create charm", function() {
 
27
           var charm = new models.Charm({name: "mysql"});
 
28
           charm.get("name").should.eql("mysql");
 
29
       });
 
30
 
 
31
    it("must be able to create charm list", function() {
 
32
        var c1 = new models.Charm({name: "mysql",
 
33
                                  description: "A DB"}),
 
34
            c2 = new models.Charm({name: "logger",
 
35
                                  description: "Log sub"}),
 
36
            clist = new models.CharmList().add([c1, c2]);
 
37
        
 
38
       });
 
39
             
 
40
    });
 
41
})();