Browse Source

clean up tests

Steven Silvester 6 years ago
parent
commit
8f9f02ec64
2 changed files with 14 additions and 2 deletions
  1. 14 1
      tests/test-notebook/src/model.spec.ts
  2. 0 1
      testutils/src/notebook-utils.ts

+ 14 - 1
tests/test-notebook/src/model.spec.ts

@@ -13,7 +13,11 @@ import { NotebookModel } from '@jupyterlab/notebook';
 
 import { ModelDB } from '@jupyterlab/observables';
 
-import { signalToPromise, NBTestUtils } from '@jupyterlab/testutils';
+import {
+  signalToPromise,
+  NBTestUtils,
+  acceptDialog
+} from '@jupyterlab/testutils';
 
 describe('@jupyterlab/notebook', () => {
   describe('NotebookModel', () => {
@@ -204,6 +208,15 @@ describe('@jupyterlab/notebook', () => {
         model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
         expect(model.nbformat).to.equal(NBTestUtils.DEFAULT_CONTENT.nbformat);
       });
+
+      it('should present a dialog when the format changes', () => {
+        const model = new NotebookModel();
+        const content = { ...NBTestUtils.DEFAULT_CONTENT };
+        content.metadata.orig_nbformat = 1;
+        model.fromJSON(content);
+        expect(model.nbformat).to.equal(nbformat.MAJOR_VERSION);
+        return acceptDialog();
+      });
     });
 
     describe('#nbformatMinor', () => {

+ 0 - 1
testutils/src/notebook-utils.ts

@@ -75,7 +75,6 @@ export namespace NBTestUtils {
   ];
 
   export const DEFAULT_CONTENT: nbformat.INotebookContent = require('../default.json') as nbformat.INotebookContent;
-  DEFAULT_CONTENT.metadata = { orig_nbformat: 1 };
 
   export const defaultEditorConfig = { ...StaticNotebook.defaultEditorConfig };