diff --git a/examples/adapting-input-and-output/index.spec.ts b/examples/adapting-input-and-output/index.spec.ts index daa49a7090..534a2241e1 100644 --- a/examples/adapting-input-and-output/index.spec.ts +++ b/examples/adapting-input-and-output/index.spec.ts @@ -8,8 +8,7 @@ describe('Should be able to generate a model with functions to serialize the dat test('and should log expected output to console', async () => { await generate(); - //Generate is called 2x, so even though we expect 1 model, we double it - expect(spy.mock.calls.length).toEqual(2); - expect(spy.mock.calls[1]).toMatchSnapshot(); + expect(spy.mock.calls.length).toEqual(1); + expect(spy.mock.calls[0]).toMatchSnapshot(); }); }); diff --git a/examples/adapting-input-and-output/index.ts b/examples/adapting-input-and-output/index.ts index 4f422b9a16..f465411958 100644 --- a/examples/adapting-input-and-output/index.ts +++ b/examples/adapting-input-and-output/index.ts @@ -52,4 +52,6 @@ export async function generate() : Promise { console.log(model.result); } } -generate(); +if (require.main === module) { + generate(); +}