Ver Fonte

Add initial poll test.

Afshin Darian há 6 anos atrás
pai
commit
a3804767e2
1 ficheiros alterados com 26 adições e 0 exclusões
  1. 26 0
      tests/test-coreutils/src/poll.spec.ts

+ 26 - 0
tests/test-coreutils/src/poll.spec.ts

@@ -0,0 +1,26 @@
+// Copyright (c) Jupyter Development Team.
+// Distributed under the terms of the Modified BSD License.
+
+import { expect } from 'chai';
+
+import { Poll } from '@jupyterlab/coreutils/src';
+
+describe('Poll', () => {
+  let poll: Poll | null;
+
+  afterEach(() => {
+    poll.dispose();
+    poll = null;
+  });
+
+  describe('#constructor()', () => {
+    it('should create a poll', () => {
+      poll = new Poll({
+        interval: 1000,
+        factory: () => Promise.resolve(),
+        when: new Promise(() => undefined) // Never.
+      });
+      expect(poll).to.be.an.instanceof(Poll);
+    });
+  });
+});