-
Notifications
You must be signed in to change notification settings - Fork 591
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* minor lightning fixes * add test * add note
- Loading branch information
1 parent
ca1ff54
commit 94871b3
Showing
5 changed files
with
30 additions
and
3 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
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,25 @@ | ||
import { describe, expect, it, vi } from "vitest"; | ||
|
||
vi.mock("recoil"); | ||
vi.mock("recoil-relay"); | ||
|
||
import { TestSelectorFamily, setMockAtoms } from "../../../../__mocks__/recoil"; | ||
import * as lightning from "./lightning"; | ||
|
||
describe("tests lightning selectors", () => { | ||
it("resolves wildcard indexed fields with database path", () => { | ||
const test = <TestSelectorFamily<typeof lightning.lightningPaths>>( | ||
(<unknown>lightning.lightningPaths("ground_truth")) | ||
); | ||
setMockAtoms({ | ||
dbPath: (p) => | ||
p === "ground_truth.id" ? "ground_truth._id" : "ground_truth.label", | ||
expandPath: () => "ground_truth", | ||
fieldPaths: () => ["id", "label"], | ||
indexesByPath: new Set(["ground_truth._id", "ground_truth.label"]), | ||
isLabelPath: () => true, | ||
}); | ||
|
||
expect(test()).toEqual(new Set(["ground_truth.id", "ground_truth.label"])); | ||
}); | ||
}); |
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