Skip to content

Commit

Permalink
Fix imports and mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
abraham committed May 1, 2024
1 parent df48ff8 commit ef914c0
Show file tree
Hide file tree
Showing 24 changed files with 33 additions and 6 deletions.
2 changes: 1 addition & 1 deletion __tests__/web.setup.ts
@@ -1,5 +1,5 @@
import { jest } from '@jest/globals';
import '@testing-library/jest-dom';
import '@testing-library/jest-dom/jest-globals';

jest.mock('firebase/messaging');
jest.mock('../src/firebase');
2 changes: 1 addition & 1 deletion src/components/about-block.test.ts
@@ -1,4 +1,4 @@
import { beforeEach, describe, it, jest } from '@jest/globals';
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
import { fireEvent, screen, within } from '@testing-library/dom';
import { mocked } from 'jest-mock';
import { html } from 'lit';
Expand Down
2 changes: 1 addition & 1 deletion src/components/auth-required.test.ts
@@ -1,4 +1,4 @@
import { beforeEach, describe, it, jest } from '@jest/globals';
import { beforeAll, beforeEach, describe, expect, it, jest } from '@jest/globals';
import { fireEvent } from '@testing-library/dom';
import { mocked } from 'jest-mock';
import { html } from 'lit';
Expand Down
2 changes: 1 addition & 1 deletion src/components/hero/hero-block.test.ts
@@ -1,4 +1,4 @@
import { beforeEach, describe, it } from '@jest/globals';
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
import { screen } from '@testing-library/dom';
import { mocked } from 'jest-mock';
import { html } from 'lit';
Expand Down
1 change: 1 addition & 0 deletions src/models/badge.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import data from '../../docs/default-firebase-data.json';
import { Badge } from './badge';
import { allKeys } from './utils';
Expand Down
1 change: 1 addition & 0 deletions src/models/day.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import data from '../../docs/default-firebase-data.json';
import { Day } from './day';
import { allKeys } from './utils';
Expand Down
1 change: 1 addition & 0 deletions src/models/feedback.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { FeedbackData } from './feedback';
import { allKeys } from './utils';

Expand Down
1 change: 1 addition & 0 deletions src/models/hero.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { Hero } from './hero';
import { allKeys } from './utils';

Expand Down
1 change: 1 addition & 0 deletions src/models/member.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import data from '../../docs/default-firebase-data.json';
import { MemberData } from './member';
import { allKeys } from './utils';
Expand Down
1 change: 1 addition & 0 deletions src/models/partner-group.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import data from '../../docs/default-firebase-data.json';
import { PartnerGroupData } from './partner-group';
import { allKeys } from './utils';
Expand Down
1 change: 1 addition & 0 deletions src/models/partner.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import data from '../../docs/default-firebase-data.json';
import { PartnerData } from './partner';
import { allKeys } from './utils';
Expand Down
1 change: 1 addition & 0 deletions src/models/post.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import data from '../../docs/default-firebase-data.json';
import { PostData } from './post';
import { allKeys } from './utils';
Expand Down
1 change: 1 addition & 0 deletions src/models/previous-session.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import data from '../../docs/default-firebase-data.json';
import { PreviousSession } from './previous-session';
import { allKeys } from './utils';
Expand Down
1 change: 1 addition & 0 deletions src/models/previous-speaker.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import data from '../../docs/default-firebase-data.json';
import { PreviousSpeaker } from './previous-speaker';
import { allKeys } from './utils';
Expand Down
1 change: 1 addition & 0 deletions src/models/session.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import data from '../../docs/default-firebase-data.json';
import { SessionData } from './session';
import { allKeys } from './utils';
Expand Down
1 change: 1 addition & 0 deletions src/models/social.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import data from '../../docs/default-firebase-data.json';
import { Social } from './social';
import { allKeys } from './utils';
Expand Down
1 change: 1 addition & 0 deletions src/models/speaker.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import data from '../../docs/default-firebase-data.json';
import { SpeakerData } from './speaker';
import { allKeys } from './utils';
Expand Down
1 change: 1 addition & 0 deletions src/models/team.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import data from '../../docs/default-firebase-data.json';
import { MemberData } from './member';
import { TeamData } from './team';
Expand Down
1 change: 1 addition & 0 deletions src/models/ticket.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import data from '../../docs/default-firebase-data.json';
import { Ticket } from './ticket';
import { allKeys } from './utils';
Expand Down
1 change: 1 addition & 0 deletions src/models/time.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import data from '../../docs/default-firebase-data.json';
import { Time } from './time';
import { allKeys } from './utils';
Expand Down
1 change: 1 addition & 0 deletions src/models/timeslot.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import data from '../../docs/default-firebase-data.json';
import { Timeslot } from './timeslot';
import { allKeys } from './utils';
Expand Down
1 change: 1 addition & 0 deletions src/models/track.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import data from '../../docs/default-firebase-data.json';
import { Track } from './track';
import { allKeys } from './utils';
Expand Down
1 change: 1 addition & 0 deletions src/models/video.test.ts
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import data from '../../docs/default-firebase-data.json';
import { allKeys } from './utils';
import { Video } from './video';
Expand Down
12 changes: 10 additions & 2 deletions src/utils/share.test.ts
@@ -1,7 +1,15 @@
import { afterEach, beforeAll, describe, expect, it } from '@jest/globals';
import { SpyInstance, spyOn } from 'jest-mock';
import { share } from './share';

type Open = (
url?: string | URL | undefined,
target?: string | undefined,
features?: string | undefined,
) => Window | null;

describe('share', () => {
let open: jest.SpyInstance<Window | null>;
let open: SpyInstance<Open>;
const features = (height: number) =>
`menubar=no,toolbar=no,resizable=yes,scrollbars=yes,width=600,height=${height}`;
const twitterUrl = [
Expand All @@ -11,7 +19,7 @@ describe('share', () => {

beforeAll(() => {
document.title = 'Awesome Schedule';
open = jest.spyOn(window, 'open').mockImplementation();
open = spyOn(window, 'open').mockImplementation(() => null);
});

afterEach(() => {
Expand Down

0 comments on commit ef914c0

Please sign in to comment.