[REM] tests: remove debug script tests

This commit is contained in:
Géry Debongnie
2021-11-13 16:01:25 +01:00
committed by Aaron Bohy
parent d5fbaff9f7
commit c1439814bf
4 changed files with 0 additions and 197 deletions
-52
View File
@@ -1,52 +0,0 @@
/**
* We can only make one test per file, since the debug tool modify in place
* the owl object in a way that is difficult to undo.
*/
// import { debugOwl } from "../../tools/debug";
// import * as owl from "../../src/index";
// import { Component, Env } from "../../src/component/component";
// import { xml } from "../../src/tags";
// import { useState } from "../../src/hooks";
// import { makeTestFixture, makeTestEnv, nextTick } from "../helpers";
// let fixture: HTMLElement = makeTestFixture();
// let env: Env = makeTestEnv();
// Component.env = env;
// debugOwl(owl, {});
test.skip("can log full lifecycle", async () => {
// const steps: string[] = [];
// const log = console.log;
// console.log = (arg) => steps.push(arg);
// class Child extends Component {
// static template = xml`<div>child</div>`;
// }
// class Parent extends Component {
// static template = xml`<div><Child t-if="state.flag"/></div>`;
// static components = { Child };
// state = useState({ flag: false });
// }
// const parent = new Parent(null, {});
// await parent.mount(fixture);
// parent.state.flag = true;
// await nextTick();
// expect(steps).toEqual([
// "[OWL_DEBUG] Parent<id=1> constructor, props={}",
// "[OWL_DEBUG] Parent<id=1> mount",
// "[OWL_DEBUG] Parent<id=1> willStart",
// "[OWL_DEBUG] Parent<id=1> rendering template",
// "[OWL_DEBUG] Parent<id=1> mounted",
// "[OWL_DEBUG] Parent<id=1> render",
// "[OWL_DEBUG] Parent<id=1> rendering template",
// "[OWL_DEBUG] Child<id=2> constructor, props={}",
// "[OWL_DEBUG] Child<id=2> willStart",
// "[OWL_DEBUG] Child<id=2> rendering template",
// "[OWL_DEBUG] Parent<id=1> willPatch",
// "[OWL_DEBUG] Child<id=2> mounted",
// "[OWL_DEBUG] Parent<id=1> patched",
// ]);
// console.log = log;
});
-46
View File
@@ -1,46 +0,0 @@
/**
* We can only make one test per file, since the debug tool modify in place
* the owl object in a way that is difficult to undo.
*/
// import { debugOwl } from "../../tools/debug";
// import * as owl from "../../src/index";
// import { Component, Env } from "../../src/component/component";
// import { xml } from "../../src/tags";
// import { makeTestFixture, makeTestEnv } from "../helpers";
// let fixture: HTMLElement = makeTestFixture();
// let env: Env = makeTestEnv();
// Component.env = env;
// debugOwl(owl, { logScheduler: true });
test.skip("can log scheduler start and stop", async () => {
// const steps: string[] = [];
// const log = console.log;
// console.log = (arg) => steps.push(arg);
// class Child extends Component {
// static template = xml`<div>child</div>`;
// }
// class Parent extends Component {
// static template = xml`<div><Child /></div>`;
// static components = { Child };
// }
// const parent = new Parent(null, {});
// await parent.mount(fixture);
// expect(steps).toEqual([
// "[OWL_DEBUG] Parent<id=1> constructor, props={}",
// "[OWL_DEBUG] Parent<id=1> mount",
// "[OWL_DEBUG] Parent<id=1> willStart",
// "[OWL_DEBUG] scheduler: start running tasks queue",
// "[OWL_DEBUG] Parent<id=1> rendering template",
// "[OWL_DEBUG] Child<id=2> constructor, props={}",
// "[OWL_DEBUG] Child<id=2> willStart",
// "[OWL_DEBUG] Child<id=2> rendering template",
// "[OWL_DEBUG] Child<id=2> mounted",
// "[OWL_DEBUG] Parent<id=1> mounted",
// "[OWL_DEBUG] scheduler: stop running tasks queue",
// ]);
// console.log = log;
});
-47
View File
@@ -1,47 +0,0 @@
/**
* We can only make one test per file, since the debug tool modify in place
* the owl object in a way that is difficult to undo.
*/
// import { debugOwl } from "../../tools/debug";
// import * as owl from "../../src/index";
// import { Component, Env } from "../../src/component/component";
// import { xml } from "../../src/tags";
// import { makeTestFixture, makeTestEnv, nextTick } from "../helpers";
// let fixture: HTMLElement = makeTestFixture();
// let env: Env = makeTestEnv();
// Component.env = env;
// debugOwl(owl, { logScheduler: true });
test.skip("log a specific message for render method calls if component is not mounted", async () => {
// const steps: string[] = [];
// const log = console.log;
// console.log = (arg) => steps.push(arg);
// class Parent extends Component {
// static template = xml`<div><t t-esc="state.value"/></div>`;
// state = owl.hooks.useState({ value: 1 });
// }
// const parent = new Parent(null, {});
// await parent.mount(fixture);
// parent.unmount();
// parent.state.value = 2;
// await nextTick();
// expect(steps).toEqual([
// "[OWL_DEBUG] Parent<id=1> constructor, props={}",
// "[OWL_DEBUG] Parent<id=1> mount",
// "[OWL_DEBUG] Parent<id=1> willStart",
// "[OWL_DEBUG] scheduler: start running tasks queue",
// "[OWL_DEBUG] Parent<id=1> rendering template",
// "[OWL_DEBUG] Parent<id=1> mounted",
// "[OWL_DEBUG] scheduler: stop running tasks queue",
// "[OWL_DEBUG] Parent<id=1> willUnmount",
// "[OWL_DEBUG] Parent<id=1> render (warning: component is not mounted)",
// "[OWL_DEBUG] scheduler: start running tasks queue",
// "[OWL_DEBUG] Parent<id=1> rendering template",
// "[OWL_DEBUG] scheduler: stop running tasks queue",
// ]);
// console.log = log;
});
-52
View File
@@ -1,52 +0,0 @@
/**
* We can only make one test per file, since the debug tool modify in place
* the owl object in a way that is difficult to undo.
*/
// import { debugOwl } from "../../tools/debug";
// import * as owl from "../../src/index";
// import { Component, Env } from "../../src/component/component";
// import { xml } from "../../src/tags";
// import { makeTestFixture, makeTestEnv } from "../helpers";
// let fixture: HTMLElement = makeTestFixture();
// let env: Env = makeTestEnv();
// Component.env = env;
// debugOwl(owl, { logScheduler: true });
test.skip("log a sub component with non stringifiable props", async () => {
// const steps: string[] = [];
// const log = console.log;
// console.log = (arg) => steps.push(arg);
// class Child extends Component {
// static template = xml`<span><t t-esc="props.obj.val"/></span>`;
// }
// const circularObject: any = { val: 1 };
// circularObject.circularObject = circularObject;
// class Parent extends Component {
// static template = xml`<div><Child obj="obj"/></div>`;
// static components = { Child };
// obj = circularObject;
// }
// const parent = new Parent(null, {});
// await parent.mount(fixture);
// parent.unmount();
// expect(steps).toEqual([
// "[OWL_DEBUG] Parent<id=1> constructor, props={}",
// "[OWL_DEBUG] Parent<id=1> mount",
// "[OWL_DEBUG] Parent<id=1> willStart",
// "[OWL_DEBUG] scheduler: start running tasks queue",
// "[OWL_DEBUG] Parent<id=1> rendering template",
// "[OWL_DEBUG] Child<id=2> constructor, props=<JSON error>",
// "[OWL_DEBUG] Child<id=2> willStart",
// "[OWL_DEBUG] Child<id=2> rendering template",
// "[OWL_DEBUG] Child<id=2> mounted",
// "[OWL_DEBUG] Parent<id=1> mounted",
// "[OWL_DEBUG] scheduler: stop running tasks queue",
// "[OWL_DEBUG] Parent<id=1> willUnmount",
// "[OWL_DEBUG] Child<id=2> willUnmount",
// ]);
// console.log = log;
});