1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-30 02:21:17 +03:00

Apply prettier formatting

This commit is contained in:
Michael Weimann
2022-12-12 12:24:14 +01:00
parent 1cac306093
commit 526645c791
1576 changed files with 65385 additions and 62478 deletions

View File

@ -16,15 +16,15 @@ limitations under the License.
import { SnakedObject, snakeToCamel } from "../../src/utils/SnakedObject";
describe('snakeToCamel', () => {
it('should convert snake_case to camelCase in simple scenarios', () => {
describe("snakeToCamel", () => {
it("should convert snake_case to camelCase in simple scenarios", () => {
expect(snakeToCamel("snake_case")).toBe("snakeCase");
expect(snakeToCamel("snake_case_but_longer")).toBe("snakeCaseButLonger");
expect(snakeToCamel("numbered_123")).toBe("numbered123"); // not a thing we would see normally
});
// Not really something we expect to see, but it's defined behaviour of the function
it('should not camelCase a trailing or leading underscore', () => {
it("should not camelCase a trailing or leading underscore", () => {
expect(snakeToCamel("_snake")).toBe("_snake");
expect(snakeToCamel("snake_")).toBe("snake_");
expect(snakeToCamel("_snake_case")).toBe("_snakeCase");
@ -32,13 +32,13 @@ describe('snakeToCamel', () => {
});
// Another thing we don't really expect to see, but is "defined behaviour"
it('should be predictable with double underscores', () => {
it("should be predictable with double underscores", () => {
expect(snakeToCamel("__snake__")).toBe("_Snake_");
expect(snakeToCamel("snake__case")).toBe("snake_case");
});
});
describe('SnakedObject', () => {
describe("SnakedObject", () => {
/* eslint-disable camelcase*/
const input = {
snake_case: "woot",
@ -48,12 +48,12 @@ describe('SnakedObject', () => {
const snake = new SnakedObject(input);
/* eslint-enable camelcase*/
it('should prefer snake_case keys', () => {
it("should prefer snake_case keys", () => {
expect(snake.get("snake_case")).toBe(input.snake_case);
expect(snake.get("snake_case", "camelCase")).toBe(input.snake_case);
});
it('should fall back to camelCase keys when needed', () => {
it("should fall back to camelCase keys when needed", () => {
// @ts-ignore - we're deliberately supplying a key that doesn't exist
expect(snake.get("camel_case")).toBe(input.camelCase);