浏览代码

Implement OutputTest helper class and its test case

Lucas de Souza 6 年之前
父节点
当前提交
6d9d55731c
共有 2 个文件被更改,包括 24 次插入0 次删除
  1. 13 0
      js/util/outputTest.js
  2. 11 0
      tests/test36.spec.js

+ 13 - 0
js/util/outputTest.js

@@ -0,0 +1,13 @@
+import { Output } from './../io/output';
+
+export class OutputTest extends Output {
+
+  constructor () {
+    super();
+    this.list = [];
+  }
+
+  sendOutput (text) {
+    this.list.push(text);
+  }
+}

+ 11 - 0
tests/test36.spec.js

@@ -0,0 +1,11 @@
+import { OutputTest } from './../js/util/outputTest';
+
+describe('Output test util class', () => {
+  it('should store the values it received', () => {
+    const values = ['1','2'];
+
+    const out = new OutputTest();
+    values.forEach( v => out.sendOutput(v));
+    expect(out.list).toEqual(['1','2']);
+  });
+});