-
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.
- [fix: append and delete bugs](d463be6) - feat: add more tests
Showing
7 changed files
with
192 additions
and
7 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,2 @@ | ||
* | ||
!dist/** |
Empty file.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,24 +1,24 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { getParentKey } from "../../src/utils"; | ||
import Flat from "../../src/Flat"; | ||
|
||
describe("getParentKey", () => { | ||
it("should return parent key for object", () => { | ||
const key = "foo__bar__baz"; | ||
const parentKey = "foo__bar"; | ||
|
||
expect(getParentKey(key)).toBe(parentKey); | ||
expect(Flat.getParentKey(key)).toBe(parentKey); | ||
}); | ||
|
||
it("should return parent key for array", () => { | ||
const key = "foo__bar__10"; | ||
const parentKey = "foo__bar"; | ||
|
||
expect(getParentKey(key)).toBe(parentKey); | ||
expect(Flat.getParentKey(key)).toBe(parentKey); | ||
}); | ||
|
||
it("should return empty string when key is root", () => { | ||
const key = "foo"; | ||
|
||
expect(getParentKey(key)).toBe(""); | ||
expect(Flat.getParentKey(key)).toBe(""); | ||
}); | ||
}); |