-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: agrega getId y elimina resolve
- Loading branch information
Showing
5 changed files
with
40 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Emulator from "../../Emulator"; | ||
const $ = new Emulator(); | ||
|
||
describe("(method) getId", () => { | ||
it("Returns the proxy's id ", () => { | ||
const totalProxies = $.length; | ||
const proxy = $.use(); | ||
const another = $.use(); | ||
|
||
expect($.getId(proxy)).toBe(totalProxies + 1); | ||
expect($.getId(another)).toBe(totalProxies + 2); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Exotic from "../../types/Exotic"; | ||
import { findProxy, map } from "../../utils"; | ||
|
||
export default function getId( | ||
scope: Exotic.Emulator, | ||
value: Exotic.traceable, | ||
): number { | ||
const proxy = findProxy(value); | ||
if (!proxy) return NaN; | ||
const { id } = map.proxies.get(proxy); | ||
return id; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters