From 142824ec01e7d467437eacaec2e9a1f17c97a4bb Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 22 Mar 2013 19:05:10 +0800 Subject: [PATCH] Add test for ProcessTask. --- spec/stdlib/process-task-shell-spec.coffee | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 spec/stdlib/process-task-shell-spec.coffee diff --git a/spec/stdlib/process-task-shell-spec.coffee b/spec/stdlib/process-task-shell-spec.coffee new file mode 100644 index 000000000..124548640 --- /dev/null +++ b/spec/stdlib/process-task-shell-spec.coffee @@ -0,0 +1,23 @@ +Task = require 'process-task' + +describe "ProcessTask shell", -> + describe "populating the window with fake properties", -> + describe "when jQuery is loaded in child process", -> + it "doesn't log to the console", -> + spyOn(console, 'log') + spyOn(console, 'error') + spyOn(console, 'warn') + class JQueryTask extends Task + constructor: -> super('fixtures/jquery-task-handler.coffee') + started: -> @callWorkerMethod('load') + loaded: (@jqueryLoaded) -> + + task = new JQueryTask() + task.start() + waitsFor "child process to start and jquery to be required", 5000, -> + task.jqueryLoaded + runs -> + expect(task.jqueryLoaded).toBeTruthy() + expect(console.log).not.toHaveBeenCalled() + expect(console.error).not.toHaveBeenCalled() + expect(console.warn).not.toHaveBeenCalled()