-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #932 from concord-consortium/186201910-formula-att…
…r-delete Improve error handling when an attribute used by formula is deleted
- Loading branch information
Showing
8 changed files
with
163 additions
and
69 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,31 @@ | ||
import { CANONICAL_NAME, isCanonicalName, rmCanonicalPrefix } from "./formula-types" | ||
|
||
describe("isCanonicalName", () => { | ||
it("returns true if the name starts with the canonical name", () => { | ||
expect(isCanonicalName(`${CANONICAL_NAME}TEST`)).toBe(true) | ||
}) | ||
it("returns false if the name does not start with the canonical name", () => { | ||
expect(isCanonicalName("FOO_BAR")).toBe(false) | ||
}) | ||
it("returns false if the name is undefined or unexpected type", () => { | ||
expect(isCanonicalName(undefined)).toBe(false) | ||
expect(isCanonicalName(1)).toBe(false) | ||
expect(isCanonicalName({})).toBe(false) | ||
expect(isCanonicalName([])).toBe(false) | ||
}) | ||
}) | ||
|
||
describe("rmCanonicalPrefix", () => { | ||
it("removes the canonical prefix from the name", () => { | ||
expect(rmCanonicalPrefix(`${CANONICAL_NAME}TEST`)).toBe("TEST") | ||
}) | ||
it("returns the original name if it does not start with the canonical name", () => { | ||
expect(rmCanonicalPrefix("FOO_BAR")).toBe("FOO_BAR") | ||
}) | ||
it("returns the if the name is undefined or unexpected type", () => { | ||
expect(rmCanonicalPrefix(undefined)).toEqual(undefined) | ||
expect(rmCanonicalPrefix(1)).toEqual(1) | ||
expect(rmCanonicalPrefix({})).toEqual({}) | ||
expect(rmCanonicalPrefix([])).toEqual([]) | ||
}) | ||
}) |
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
Oops, something went wrong.