Skip to content

Commit 706171c

Browse files
committed
suit testing of nodeapp is done
1 parent 35c9764 commit 706171c

File tree

4 files changed

+7256
-790
lines changed

4 files changed

+7256
-790
lines changed

nodeapp/babel.config.cjs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module.exports = {
2+
presets: [["@babel/preset-env", { targets: { node: "current" } }]],
3+
plugins: [
4+
// Plugin mejorado para transformar import.meta durante los tests
5+
function () {
6+
return {
7+
visitor: {
8+
MetaProperty(path) {
9+
if (
10+
path.node.meta.name === "import" &&
11+
path.node.property.name === "meta"
12+
) {
13+
path.replaceWithSourceString(
14+
'Object.assign(Object.create(null), { url: "file:///mock-url", dirname: "." })'
15+
);
16+
}
17+
},
18+
},
19+
};
20+
},
21+
],
22+
};

nodeapp/lib/sessionManager.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { guard, sessionManager } from "./sessionManager.js";
2+
3+
describe("sessionManager", () => {
4+
it("Deberia exportar guard como funcion", () => {
5+
expect(typeof guard).toBe("function");
6+
});
7+
});

0 commit comments

Comments
 (0)