generated from graasp/graasp-repo
-
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.
fix: adapt types to use
@graasp/sdk/frontend
instead of query-client (
#74) fix(test): use convertJs instead of removed ImmutableMember fix: build with alias resolution and export function param types
- Loading branch information
Showing
30 changed files
with
1,320 additions
and
1,006 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,20 +1,15 @@ | ||
/// <reference types="../cypress"/> | ||
import { List, Record } from 'immutable'; | ||
import { List } from 'immutable'; | ||
import { v4 } from 'uuid'; | ||
|
||
import { QueryObserverResult } from 'react-query'; | ||
|
||
import { Member, MemberType, MentionStatus, convertJs } from '@graasp/sdk'; | ||
import { | ||
ChatMention, | ||
ChatMentionRecord, | ||
Member, | ||
MemberExtra, | ||
MemberExtraRecord, | ||
MemberMentions, | ||
MemberMentionsRecord, | ||
MemberRecord, | ||
} from '@graasp/query-client/dist/types'; | ||
import { MentionStatus } from '@graasp/sdk'; | ||
} from '@graasp/sdk/frontend'; | ||
|
||
import { CHAT_MESSAGES } from './chat_messages'; | ||
import { CURRENT_MEMBER, MEMBERS } from './members'; | ||
|
@@ -53,50 +48,41 @@ export const mockUseMentions = | |
status: MentionStatus.UNREAD, | ||
}; | ||
|
||
const createMention: Record.Factory<ChatMention> = Record(defaultMention); | ||
const CHAT_MENTION_1: ChatMentionRecord = createMention({ | ||
const CHAT_MENTION_1: ChatMention = { | ||
...defaultMention, | ||
id: v4(), | ||
creator: MEMBERS.BOB.id, | ||
messageId: CHAT_MESSAGES[0].id, | ||
}); | ||
const CHAT_MENTION_2: ChatMentionRecord = createMention({ | ||
}; | ||
const CHAT_MENTION_2: ChatMention = { | ||
...defaultMention, | ||
id: v4(), | ||
creator: MEMBERS.ANNA.id, | ||
messageId: CHAT_MESSAGES[1].id, | ||
}); | ||
|
||
const defaultMemberMentionsValues: MemberMentions = { | ||
memberId: '', | ||
mentions: List([]), | ||
}; | ||
|
||
const createMockMemberMentions: Record.Factory<MemberMentions> = Record( | ||
defaultMemberMentionsValues, | ||
); | ||
const MEMBER_MENTIONS: MemberMentionsRecord = createMockMemberMentions({ | ||
const MEMBER_MENTIONS: MemberMentionsRecord = convertJs({ | ||
memberId: CURRENT_MEMBER.id, | ||
mentions: List([CHAT_MENTION_1, CHAT_MENTION_2]), | ||
mentions: [CHAT_MENTION_1, CHAT_MENTION_2], | ||
}); | ||
return { | ||
data: MEMBER_MENTIONS, | ||
} as unknown as QueryObserverResult<MemberMentionsRecord>; | ||
}; | ||
|
||
export const mockUseMembers = (): QueryObserverResult<List<MemberRecord>> => { | ||
const defaultMemberExtra: MemberExtra = { | ||
hasAvatar: false, | ||
}; | ||
const createMemberExtra: Record.Factory<MemberExtra> = | ||
Record(defaultMemberExtra); | ||
const extra: MemberExtraRecord = createMemberExtra(); | ||
const defaultMember: Member = { | ||
id: '', | ||
name: '', | ||
extra, | ||
extra: {}, | ||
type: MemberType.Individual, | ||
email: '[email protected]', | ||
createdAt: 'somedate', | ||
updatedAt: 'someotherDate', | ||
}; | ||
|
||
const createMember: Record.Factory<Member> = Record(defaultMember); | ||
const createMember = (member: Partial<Member>): MemberRecord => | ||
convertJs({ ...defaultMember, ...member }); | ||
|
||
return { | ||
data: List([ | ||
|
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
File renamed without changes.
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
Oops, something went wrong.