forked from thislooksfun/snoots
-
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.
This is prep for enabling unicorn/no-null, but it's also good practice and resulted in nicer code. BREAKING CHANGE: All internal usages of `null` have been replaced with `undefined`. This includes mapping `null` to `undefined` in Reddit's API responses. If you were checking any values for existence with `=== null` you should replace that check with `=== undefined` (or `== null` or `== undefined`).
- Loading branch information
1 parent
113c7aa
commit 5ab17b6
Showing
21 changed files
with
232 additions
and
223 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
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
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,17 +1,24 @@ | ||
import * as util from "../../util"; | ||
|
||
describe("camelCaseKeys()", () => { | ||
describe("fromRedditData()", () => { | ||
it("should convert keys to camel case", () => { | ||
const a = { foo_bar: "a", bar_foo: "b" }; | ||
const b = { fooBar: "a", barFoo: "b" }; | ||
|
||
expect(util.camelCaseKeys(a)).toStrictEqual(b); | ||
expect(util.fromRedditData(a)).toStrictEqual(b); | ||
}); | ||
|
||
it("should preserve camel cased keys", () => { | ||
const a = { fooBar: "a", barFoo: "b" }; | ||
const b = { fooBar: "a", barFoo: "b" }; | ||
|
||
expect(util.camelCaseKeys(a)).toStrictEqual(b); | ||
expect(util.fromRedditData(a)).toStrictEqual(b); | ||
}); | ||
|
||
it("should replace null with undefined", () => { | ||
const a = { fooBar: null, barFoo: undefined }; | ||
const b = { fooBar: undefined, barFoo: undefined }; | ||
|
||
expect(util.fromRedditData(a)).toStrictEqual(b); | ||
}); | ||
}); |
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
Oops, something went wrong.