Revert "fixing unit test with custom attribute"

This reverts commit 66729cfc60.
This commit is contained in:
Roland Osborne 2024-05-02 15:16:16 -07:00
parent 89217cd441
commit d38d60119b
9 changed files with 23 additions and 26 deletions

View File

@ -20,7 +20,7 @@ function CardView() {
<div <div
key={entry.id} key={entry.id}
data-testid="card" data-testid="card"
data-offsync={entry.offsync.toString()} offsync={entry.offsync.toString()}
> >
<span data-testid="name">{entry.data.cardProfile.name}</span> <span data-testid="name">{entry.data.cardProfile.name}</span>
<span data-testid="status">{entry.data.cardDetail.status}</span> <span data-testid="status">{entry.data.cardDetail.status}</span>
@ -36,8 +36,8 @@ function CardView() {
//@ts-ignore //@ts-ignore
<div <div
data-testid="cards" data-testid="cards"
data-count={renderCount} count={renderCount}
data-offsync={card.state.offsync.toString()} offsync={card.state.offsync.toString()}
> >
{cards} {cards}
</div> </div>
@ -137,7 +137,7 @@ test('resync cards', async () => {
await waitFor(async () => { await waitFor(async () => {
//@ts-ignore //@ts-ignore
expect(screen.getByTestId('cards').attributes['data-offsync'].value).toBe('true'); expect(screen.getByTestId('cards').attributes.offsync.value).toBe('true');
}); });
statusCards = 200; statusCards = 200;
@ -148,7 +148,7 @@ test('resync cards', async () => {
await waitFor(async () => { await waitFor(async () => {
//@ts-ignore //@ts-ignore
expect(screen.getByTestId('cards').attributes['data-offsync'].value).toBe('false'); expect(screen.getByTestId('cards').attributes.offsync.value).toBe('false');
}); });
act(() => { act(() => {
@ -216,7 +216,7 @@ test('resync contact', async () => {
await waitFor(async () => { await waitFor(async () => {
//@ts-ignore //@ts-ignore
expect(screen.getByTestId('card').attributes['data-offsync'].value).toBe('true'); expect(screen.getByTestId('card').attributes.offsync.value).toBe('true');
}); });
statusMessage = 200; statusMessage = 200;
@ -227,7 +227,7 @@ test('resync contact', async () => {
await waitFor(async () => { await waitFor(async () => {
//@ts-ignore //@ts-ignore
expect(screen.getByTestId('card').attributes['data-offsync'].value).toBe('false'); expect(screen.getByTestId('card').attributes.offsync.value).toBe('false');
}); });
act(() => { act(() => {

View File

@ -33,8 +33,8 @@ function ChannelView() {
//@ts-ignore //@ts-ignore
<div <div
data-testid="channels" data-testid="channels"
data-count={renderCount} count={renderCount}
data-offsync={channel.state.offsync.toString()} offsync={channel.state.offsync.toString()}
> >
{channels} {channels}
</div> </div>
@ -204,7 +204,7 @@ test('add, update and remove channel', async () => {
await channelContext.actions.setRevision(1); await channelContext.actions.setRevision(1);
}); });
//screen.getByTestId('count').attributes['data-count'].value //screen.getByTestId('count').attributes.count.value
//console.log(prettyDOM(screen.getByTestId('channels'))); //console.log(prettyDOM(screen.getByTestId('channels')));
await waitFor(async () => { await waitFor(async () => {
@ -213,11 +213,8 @@ test('add, update and remove channel', async () => {
expect(screen.getByTestId('summary').textContent).toBe('testdata'); expect(screen.getByTestId('summary').textContent).toBe('testdata');
}); });
console.log("GET CHANNELS");
console.log(screen.getByTestId('channels'));
//@ts-ignore //@ts-ignore
const count = parseInt(screen.getByTestId('channels').attributes['data-count'].value) + 1; const count = parseInt(screen.getByTestId('channels').attributes.count.value) + 1;
fetchChannels = [ fetchChannels = [
{ {
@ -239,7 +236,7 @@ console.log(screen.getByTestId('channels'));
expect(screen.getByTestId('channels').children).toHaveLength(1); expect(screen.getByTestId('channels').children).toHaveLength(1);
expect(screen.getByTestId('detail').textContent).toBe('testdata2'); expect(screen.getByTestId('detail').textContent).toBe('testdata2');
//@ts-ignore //@ts-ignore
expect(screen.getByTestId('channels').attributes['data-count'].value).toBe(count.toString()); expect(screen.getByTestId('channels').attributes.count.value).toBe(count.toString());
}); });
fetchChannels = [{ id: '123', revision: 3 }]; fetchChannels = [{ id: '123', revision: 3 }];
@ -262,7 +259,7 @@ console.log(screen.getByTestId('channels'));
await waitFor(async () => { await waitFor(async () => {
//@ts-ignore //@ts-ignore
expect(screen.getByTestId('channels').attributes['data-offsync'].value).toBe('false'); expect(screen.getByTestId('channels').attributes.offsync.value).toBe('false');
}); });
await act(async () => { await act(async () => {
@ -288,7 +285,7 @@ test('resync', async () => {
await waitFor(async () => { await waitFor(async () => {
//@ts-ignore //@ts-ignore
expect(screen.getByTestId('channels').attributes['data-offsync'].value).toBe('true'); expect(screen.getByTestId('channels').attributes.offsync.value).toBe('true');
}); });
await act(async () => { await act(async () => {
@ -298,6 +295,6 @@ test('resync', async () => {
await waitFor(async () => { await waitFor(async () => {
//@ts-ignore //@ts-ignore
expect(screen.getByTestId('channels').attributes['data-offsync'].value).toBe('false'); expect(screen.getByTestId('channels').attributes.offsync.value).toBe('false');
}); });
}); });

View File

@ -45,7 +45,7 @@ function ContactsView() {
//@ts-ignore //@ts-ignore
<div <div
data-testid="cards" data-testid="cards"
data-count={renderCount} count={renderCount}
> >
{cards} {cards}
</div> </div>

View File

@ -42,8 +42,8 @@ function ConversationView() {
//@ts-ignore //@ts-ignore
<div <div
data-testid="topics" data-testid="topics"
data-count={renderCount} count={renderCount}
data-offsync={card.state.offsync.toString()} offsync={card.state.offsync.toString()}
> >
{topics} {topics}
</div> </div>

View File

@ -27,7 +27,7 @@ function InfoView() {
//@ts-ignore //@ts-ignore
<div <div
data-testid="info" data-testid="info"
data-count={renderCount} count={renderCount}
> >
{state.title} {state.title}
</div> </div>

View File

@ -37,7 +37,7 @@ function ListingView() {
//@ts-ignore //@ts-ignore
<div <div
data-testid="contacts" data-testid="contacts"
data-count={renderCount} count={renderCount}
> >
{contacts} {contacts}
</div> </div>

View File

@ -43,7 +43,7 @@ function ThreadView() {
//@ts-ignore //@ts-ignore
<div <div
data-testid="thread" data-testid="thread"
data-count={renderCount} count={renderCount}
> >
{topics} {topics}
</div> </div>

View File

@ -48,7 +48,7 @@ function TopicsView() {
//@ts-ignore //@ts-ignore
<div <div
data-testid="channels" data-testid="channels"
data-count={renderCount} count={renderCount}
> >
{channels} {channels}
</div> </div>

View File

@ -29,7 +29,7 @@ function ProfileView() {
//@ts-ignore //@ts-ignore
<div <div
data-testid="name" data-testid="name"
data-count={renderCount} count={renderCount}
> >
{name} {name}
</div> </div>