Skip to content

Commit f8a97cb

Browse files
committed
test: more fixes
1 parent 5664c04 commit f8a97cb

File tree

1 file changed

+64
-17
lines changed

1 file changed

+64
-17
lines changed

packages/myst-cli/src/transforms/outputs.spec.ts

Lines changed: 64 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,26 @@ describe('reduceOutputs', () => {
3434
},
3535
],
3636
};
37-
expect(mdast.children[0].children.length).toEqual(2);
3837
reduceOutputs(new Session(), mdast, 'notebook.ipynb', '/my/folder');
39-
expect(mdast.children[0].children.length).toEqual(1);
38+
expect(mdast).toEqual({
39+
type: 'root',
40+
children: [
41+
{
42+
type: 'block',
43+
children: [
44+
{
45+
type: 'paragraph',
46+
children: [
47+
{
48+
type: 'text',
49+
value: 'hi',
50+
},
51+
],
52+
},
53+
],
54+
},
55+
],
56+
});
4057
});
4158
it('output with complex data is removed', async () => {
4259
const mdast = {
@@ -82,7 +99,25 @@ describe('reduceOutputs', () => {
8299
};
83100
expect(mdast.children[0].children.length).toEqual(2);
84101
reduceOutputs(new Session(), mdast, 'notebook.ipynb', '/my/folder');
85-
expect(mdast.children[0].children.length).toEqual(1);
102+
expect(mdast).toEqual({
103+
type: 'root',
104+
children: [
105+
{
106+
type: 'block',
107+
children: [
108+
{
109+
type: 'paragraph',
110+
children: [
111+
{
112+
type: 'text',
113+
value: 'hi',
114+
},
115+
],
116+
},
117+
],
118+
},
119+
],
120+
});
86121
});
87122
it('output is replaced with placeholder image', async () => {
88123
const mdast = {
@@ -105,15 +140,9 @@ describe('reduceOutputs', () => {
105140
id: 'abc123',
106141
children: [
107142
{
108-
type: 'output',
109-
jupyter_data: null,
110-
children: [
111-
{
112-
type: 'image',
113-
placeholder: true,
114-
url: 'placeholder.png',
115-
},
116-
],
143+
type: 'image',
144+
placeholder: true,
145+
url: 'placeholder.png',
117146
},
118147
],
119148
},
@@ -123,11 +152,29 @@ describe('reduceOutputs', () => {
123152
};
124153
expect(mdast.children[0].children.length).toEqual(2);
125154
reduceOutputs(new Session(), mdast, 'notebook.ipynb', '/my/folder');
126-
expect(mdast.children[0].children.length).toEqual(2);
127-
expect(mdast.children[0].children[1]).toEqual({
128-
type: 'image',
129-
placeholder: true,
130-
url: 'placeholder.png',
155+
expect(mdast).toEqual({
156+
type: 'root',
157+
children: [
158+
{
159+
type: 'block',
160+
children: [
161+
{
162+
type: 'paragraph',
163+
children: [
164+
{
165+
type: 'text',
166+
value: 'hi',
167+
},
168+
],
169+
},
170+
{
171+
type: 'image',
172+
placeholder: true,
173+
url: 'placeholder.png',
174+
},
175+
],
176+
},
177+
],
131178
});
132179
});
133180
// // These tests now require file IO...

0 commit comments

Comments
 (0)