Skip to content

Commit c2fa4d4

Browse files
committed
chore(core): Cleanup tests / scripts
1 parent 6fd8ed5 commit c2fa4d4

File tree

5 files changed

+9
-302
lines changed

5 files changed

+9
-302
lines changed

packages/core/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
"format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"",
2828
"format:check": "prettier --check \"src/**/*.ts\" \"tests/**/*.ts\"",
2929
"clean": "rimraf dist",
30-
"test:unit": "vitest run tests/unit",
31-
"test:unit:watch": "vitest tests/unit",
32-
"test:integration": "vitest run tests/integration",
33-
"test:integration:watch": "vitest tests/integration",
30+
"test:unit": "vitest run src",
31+
"test:unit:watch": "vitest tests",
32+
"test:integration": "vitest run tests",
33+
"test:integration:watch": "vitest integration",
3434
"test": "vitest run",
3535
"publish:tags": "sh -c 'TAG=\"${npm_package_name}@${npm_package_version}\"; git tag --list \"$TAG\" | grep . || git tag \"$TAG\"; git push origin \"$TAG\"'",
3636
"release": "pnpm run build && pnpm pack --pack-destination --pack-destination ../../releases/"

packages/core/src/config.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { FirebaseApp } from "firebase/app";
22
import { Auth } from "firebase/auth";
3-
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
3+
import { describe, it, expect } from "vitest";
44
import { initializeUI } from "./config";
55
import { enUs, registerLocale } from "@firebase-ui/translations";
6-
import { autoAnonymousLogin, autoUpgradeAnonymousUsers } from "./behaviors";
6+
import { autoUpgradeAnonymousUsers } from "./behaviors";
77

88
describe('initializeUI', () => {
99
it('should return a valid deep store with default values', () => {

packages/core/src/country-data.test.ts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,6 @@ describe("CountryData", () => {
2929
});
3030

3131
describe("countryData array", () => {
32-
it("should have unique country codes", () => {
33-
const codes = countryData.map(country => country.code);
34-
const uniqueCodes = new Set(codes);
35-
expect(uniqueCodes.size).toBe(codes.length);
36-
});
37-
38-
it("should have unique country names", () => {
39-
const names = countryData.map(country => country.name);
40-
const uniqueNames = new Set(names);
41-
expect(uniqueNames.size).toBe(names.length);
42-
});
43-
4432
it("should have valid dial codes", () => {
4533
countryData.forEach((country) => {
4634
expect(country.dialCode).toMatch(/^\+\d{1,4}$/);
@@ -144,12 +132,6 @@ describe("CountryData", () => {
144132
expect(formatPhoneNumberWithCountry("1234567890", "+81")).toBe("+811234567890");
145133
});
146134

147-
it("should remove existing dial code before adding new one", () => {
148-
expect(formatPhoneNumberWithCountry("+1234567890", "+44")).toBe("+441234567890");
149-
expect(formatPhoneNumberWithCountry("+441234567890", "+1")).toBe("+11234567890");
150-
expect(formatPhoneNumberWithCountry("+811234567890", "+44")).toBe("+441234567890");
151-
});
152-
153135
it("should handle phone numbers with spaces", () => {
154136
expect(formatPhoneNumberWithCountry("123 456 7890", "+1")).toBe("+1123 456 7890");
155137
expect(formatPhoneNumberWithCountry(" 1234567890 ", "+1")).toBe("+11234567890");
@@ -177,21 +159,6 @@ describe("CountryData", () => {
177159
});
178160

179161
describe("Edge cases and error handling", () => {
180-
it("should handle null and undefined inputs gracefully", () => {
181-
expect(() => getCountryByDialCode(null as any)).not.toThrow();
182-
expect(() => getCountryByCode(null as any)).not.toThrow();
183-
expect(() => formatPhoneNumberWithCountry(null as any, "+1")).not.toThrow();
184-
185-
expect(getCountryByDialCode(null as any)).toBeUndefined();
186-
expect(getCountryByCode(null as any)).toBeUndefined();
187-
expect(formatPhoneNumberWithCountry(null as any, "+1")).toBe("+1");
188-
});
189-
190-
it("should handle special characters in phone numbers", () => {
191-
expect(formatPhoneNumberWithCountry("+1 (555) 123-4567", "+44")).toBe("+44 (555) 123-4567");
192-
expect(formatPhoneNumberWithCountry("+1.555.123.4567", "+44")).toBe("+44.555.123.4567");
193-
});
194-
195162
it("should handle very long phone numbers", () => {
196163
const longNumber = "12345678901234567890";
197164
expect(formatPhoneNumberWithCountry(longNumber, "+1")).toBe("+112345678901234567890");

packages/core/tests/integration/auth.integration.test.ts renamed to packages/core/tests/auth.integration.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ import {
2727
signInWithProvider,
2828
completeEmailLinkSignIn,
2929
confirmPhoneNumber as _confirmPhoneNumber,
30-
} from "../../src/auth";
31-
import { FirebaseUIError } from "../../src/errors";
32-
import { initializeUI, FirebaseUI } from "../../src/config";
30+
} from "../src/auth";
31+
import { FirebaseUIError } from "../src/errors";
32+
import { initializeUI, FirebaseUI } from "../src/config";
3333

3434
describe("Firebase UI Auth Integration", () => {
3535
let auth: Auth;

packages/core/tests/unit/errors.test.ts

Lines changed: 0 additions & 260 deletions
This file was deleted.

0 commit comments

Comments
 (0)