Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Airthee committed Apr 23, 2024
1 parent f6118b5 commit 11130a6
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 48 deletions.
44 changes: 22 additions & 22 deletions src/utils/card.test.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
import { describe, expect, it } from 'vitest';
import * as card from './card';
import { describe, expect, it } from "vitest";
import * as card from "./card";

describe('Utils: card', () => {
describe('Function: getSquareShape', () => {
describe("Utils: card", () => {
describe("Function: getSquareShape", () => {
it('Should return "overflowSquare"', () => {
const result = card.getSquareShape(true);
expect(result).toEqual('overflowSquare');
})
expect(result).toEqual("overflowSquare");
});
it('Should return "square"', () => {
const result = card.getSquareShape(false);
expect(result).toEqual('square');
})
})
expect(result).toEqual("square");
});
});

describe('Function: getBackdropShape', () => {
describe("Function: getBackdropShape", () => {
it('Should return "overflowBackdrop"', () => {
const result = card.getBackdropShape(true);
expect(result).toEqual('overflowBackdrop');
})
expect(result).toEqual("overflowBackdrop");
});
it('Should return "backdrop"', () => {
const result = card.getBackdropShape(false);
expect(result).toEqual('backdrop');
})
})
expect(result).toEqual("backdrop");
});
});

describe('Function: getPortraitShape', () => {
describe("Function: getPortraitShape", () => {
it('Should return "overflowPortrait"', () => {
const result = card.getPortraitShape(true);
expect(result).toEqual('overflowPortrait');
})
expect(result).toEqual("overflowPortrait");
});
it('Should return "portrait"', () => {
const result = card.getPortraitShape(false);
expect(result).toEqual('portrait');
})
})
})
expect(result).toEqual("portrait");
});
});
});
55 changes: 29 additions & 26 deletions src/utils/dateFnsLocale.test.ts
Original file line number Diff line number Diff line change
@@ -1,55 +1,58 @@
import { describe, expect, it } from 'vitest';
import * as dateFnsLocale from './dateFnsLocale';
import { describe, expect, it } from "vitest";
import * as dateFnsLocale from "./dateFnsLocale";

describe('Utils: dateFnsLocale', () => {
describe('Function: getLocale', () => {
describe("Utils: dateFnsLocale", () => {
describe("Function: getLocale", () => {
it('Should return "en-US" by default', () => {
const { code } = dateFnsLocale.getLocale();
expect(code).toEqual('en-US');
})
})
expect(code).toEqual("en-US");
});
});

describe('Function: getLocaleWithSuffix', () => {
describe("Function: getLocaleWithSuffix", () => {
it('Should return "en-US" by default with addSuffix to true', () => {
const { addSuffix, locale } = dateFnsLocale.getLocaleWithSuffix();

expect(addSuffix).toEqual(true);
expect(locale.code).toEqual('en-US');
})
})
expect(locale.code).toEqual("en-US");
});
});

describe('Function: updateLocale', () => {
describe("Function: updateLocale", () => {
it('Should import "fr-ca" locale', async () => {
const expectedCode = 'fr-CA';
const expectedCode = "fr-CA";

await dateFnsLocale.updateLocale('fr-ca');
await dateFnsLocale.updateLocale("fr-ca");
const { code } = dateFnsLocale.getLocale();
const { locale: localeWithSuffix } = dateFnsLocale.getLocaleWithSuffix();
const { locale: localeWithSuffix } =
dateFnsLocale.getLocaleWithSuffix();

expect(code).toEqual(expectedCode);
expect(localeWithSuffix.code).toEqual(expectedCode);
})
});

it('Should import "fr" locale', async () => {
const expectedCode = 'fr';
const expectedCode = "fr";

await dateFnsLocale.updateLocale('fr-fr');
await dateFnsLocale.updateLocale("fr-fr");
const { code } = dateFnsLocale.getLocale();
const { locale: localeWithSuffix } = dateFnsLocale.getLocaleWithSuffix();
const { locale: localeWithSuffix } =
dateFnsLocale.getLocaleWithSuffix();

expect(code).toEqual(expectedCode);
expect(localeWithSuffix.code).toEqual(expectedCode);
})
});

it('Should import "en-US" locale if given locale is not found', async () => {
const expectedCode = 'en-US';
const expectedCode = "en-US";

await dateFnsLocale.updateLocale('unknown-unknown');
await dateFnsLocale.updateLocale("unknown-unknown");
const { code } = dateFnsLocale.getLocale();
const { locale: localeWithSuffix } = dateFnsLocale.getLocaleWithSuffix();
const { locale: localeWithSuffix } =
dateFnsLocale.getLocaleWithSuffix();

expect(code).toEqual(expectedCode);
expect(localeWithSuffix.code).toEqual(expectedCode);
})
})
})
});
});
});

0 comments on commit 11130a6

Please sign in to comment.