Sha256: 848dedf8dbbbcbe9cba60dd63265b93aba9d437414ce946b20cc02654151fd95

Contents?: true

Size: 1.42 KB

Versions: 4

Compression:

Stored size: 1.42 KB

Contents

require([
		'classes/builtin-commands', 
		'specs/doubles/uiobject-double', 
		'specs/doubles/mock-jamservice'
		], function(){
		
		module("describe ls command spec")
		
		test("it should write return items to the console if list", function() {
		  	
			// arrange
			var items = [{title:'item1', href:"/articles/item2"}, {title:'item2', href:"/articles/item2"}];
			var service = new MockJamService(items);
			var lsCommand = new LsCommand(service);
			Session.currentFolder = "articles";
			
		  	// act
			lsCommand.execute(null, function(output){
				
				equal(output, "<FILE>  item1\n<FILE>  item2\n");
				
			});
			
			
		});
		
		test("it should write the same item to console if resource", function() {
		  	
			// arrange
			var items = {title:'item1', href:"/articles/item1"};
			var service = new MockJamService(items);
			var lsCommand = new LsCommand(service);
			Session.currentFolder = "articles";
			
		  	// act
			lsCommand.execute(null, function(output){
				
				equal(output, "<FILE>  item1\n");
				
			});

		});
		
		test("it should write error when arguments given", function() {
		  	
			// arrange
			var items = {title:'item1'};
			var service = new MockJamService(items);
			var lsCommand = new LsCommand(service);
			Session.currentFolder = "articles";
			
		  	// act
			lsCommand.execute(["something", "something"], function(output){
				
				equal(output, "wrong number of arguments!");
			
			});
			
		});
				
	});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
koda-0.0.12 public/koda/scripts/specs/ls-command-spec.js
koda-0.0.11 public/koda/scripts/specs/ls-command-spec.js
koda-0.0.9 public/koda/scripts/specs/ls-command-spec.js
koda-0.0.8 public/koda/scripts/specs/ls-command-spec.js