Skip to content

Commit

Permalink
test: added
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed May 25, 2023
1 parent 234fc91 commit b34ff83
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
10 changes: 8 additions & 2 deletions test/cases/inner-graph/extend-class2/dep-decl.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { A, B, getC, getD, getE, getF, Foo } from "./dep2?decl";
import { A3, B3, C3, D3, E3, F3 } from "./dep3?decl";
import { A, B, getC, getD, getE, getF, Foo, Pure } from "./dep2?decl";
import { A3, B3, C3, D3, E3, F3, Pure3 } from "./dep3?decl";

export class A1 extends A {
render() {
Expand Down Expand Up @@ -133,6 +133,12 @@ export default class DefaultBar extends Foo {
}
}

export class ExtendsPure extends Pure {
render() {
return new Pure3();
}
}

export class A2 extends A3 {}
export class B2 extends B3 {}
export class C2 extends C3 {}
Expand Down
10 changes: 8 additions & 2 deletions test/cases/inner-graph/extend-class2/dep-expr.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { A, B, getC, getD, getE, getF } from "./dep2?expr";
import { A3, B3, C3, D3, E3, F3 } from "./dep3?expr";
import { A, B, getC, getD, getE, getF, Pure } from "./dep2?expr";
import { A3, B3, C3, D3, E3, F3, Pure3} from "./dep3?expr";

export const A1 = class extends A {
render() {
Expand Down Expand Up @@ -39,6 +39,12 @@ export const F1 = class extends getF() {
}
};

export const ExtendsPure = class extends Pure {
render() {
return new Pure3();
}
};

export const A2 = class extends A3 {};
export const B2 = class extends B3 {};
export const C2 = class extends C3 {};
Expand Down
2 changes: 2 additions & 0 deletions test/cases/inner-graph/extend-class2/dep2.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const getD = () => class D {};
export const getE = () => class E {};
export const getF = () => class F {};
export class Foo { static Bar = Foo; }
export class Pure {}

export const exportsInfoForA = __webpack_exports_info__.A.used;
export const exportsInfoForB = __webpack_exports_info__.B.used;
Expand All @@ -13,3 +14,4 @@ export const exportsInfoForD = __webpack_exports_info__.getD.used;
export const exportsInfoForE = __webpack_exports_info__.getE.used;
export const exportsInfoForF = __webpack_exports_info__.getF.used;
export const exportsInfoForFoo = __webpack_exports_info__.Foo.used;
export const exportsInfoForPure = __webpack_exports_info__.Pure.used;
1 change: 1 addition & 0 deletions test/cases/inner-graph/extend-class2/dep3.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export class C3 {}
export class D3 {}
export class E3 {}
export class F3 {}
export class Pure3 {}
9 changes: 8 additions & 1 deletion test/cases/inner-graph/extend-class2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
exportsInfoForD as declD,
exportsInfoForE as declE,
exportsInfoForF as declF,
exportsInfoForFoo as declFoo
exportsInfoForFoo as declFoo,
exportsInfoForPure as declPure
} from "./dep2?decl";
import {
exportsInfoForA as exprA,
Expand All @@ -14,6 +15,7 @@ import {
exportsInfoForD as exprD,
exportsInfoForE as exprE,
exportsInfoForF as exprF,
exportsInfoForPure as exprPure,
} from "./dep2?expr";

it("should load module correctly", () => {
Expand Down Expand Up @@ -51,6 +53,11 @@ it("E should be used", () => {
});

it("F should be used", () => {
if (process.env.NODE_ENV === "production") {
expect(declPure).toBe(false);
expect(exprPure).toBe(false);
}

// Note: it has side-effects and is not affected by usage of the class
expect(declF).toBe(true);
expect(declFoo).toBe(true);
Expand Down

0 comments on commit b34ff83

Please sign in to comment.