Jelajahi Sumber

Fix nbformat conversion dialog test.

The shallow copy from before created a reference to the metadata object, so we were actually modifying the default notebook content, not a copy.
Jason Grout 6 tahun lalu
induk
melakukan
b117452de3
1 mengubah file dengan 7 tambahan dan 2 penghapusan
  1. 7 2
      tests/test-notebook/src/model.spec.ts

+ 7 - 2
tests/test-notebook/src/model.spec.ts

@@ -211,8 +211,13 @@ describe('@jupyterlab/notebook', () => {
 
       it('should present a dialog when the format changes', () => {
         const model = new NotebookModel();
-        const content = { ...NBTestUtils.DEFAULT_CONTENT };
-        content.metadata.orig_nbformat = 1;
+        const content = {
+          ...NBTestUtils.DEFAULT_CONTENT,
+          metadata: {
+            ...NBTestUtils.DEFAULT_CONTENT.metadata,
+            orig_nbformat: 1
+          }
+        };
         model.fromJSON(content);
         expect(model.nbformat).to.equal(nbformat.MAJOR_VERSION);
         return acceptDialog();