Skip to content

Commit 95cb256

Browse files
committed
Fix some expectEvents calls
Knowing that I have to fix every call like this makes me wonder if I shouldn’t just remove this altogether like in realm server tests.
1 parent 6a169a5 commit 95cb256

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

packages/host/tests/integration/components/card-copy-test.gts

+15-7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ import OperatorMode from '@cardstack/host/components/operator-mode/container';
2020

2121
import OperatorModeStateService from '@cardstack/host/services/operator-mode-state-service';
2222

23+
import {
24+
IncrementalIndexEventContent,
25+
IndexRealmEventContent,
26+
} from 'https://cardstack.com/base/matrix-event';
27+
2328
import {
2429
percySnapshot,
2530
testRealmURL,
@@ -771,7 +776,7 @@ module('Integration | card-copy', function (hooks) {
771776
expectedNumberOfEvents: 4,
772777
onEvents: (events) => {
773778
assert.deepEqual(
774-
events.map((e) => e.data.type),
779+
events.map((e: IndexRealmEventContent) => e.indexType),
775780
[
776781
'incremental-index-initiation',
777782
'incremental',
@@ -782,8 +787,10 @@ module('Integration | card-copy', function (hooks) {
782787
);
783788
assert.deepEqual(
784789
flatMap(
785-
events.filter((e) => e.data.type === 'incremental'),
786-
(e) => e.data.invalidations,
790+
events.filter(
791+
(e: IndexRealmEventContent) => e.indexType === 'incremental',
792+
),
793+
(e: IncrementalIndexEventContent) => e.invalidations,
787794
),
788795
[savedCards[0].data.id, savedCards[1].data.id],
789796
'event invalidations are correct',
@@ -919,10 +926,11 @@ module('Integration | card-copy', function (hooks) {
919926
realm: realm2,
920927
expectedNumberOfEvents: 2,
921928
onEvents: ([_, event]) => {
922-
if (event.data.type === 'incremental') {
923-
assert.deepEqual(event.data.invalidations, [
924-
`${testRealm2URL}Person/${id}`,
925-
]);
929+
if (event.eventName === 'index' && event.indexType === 'incremental') {
930+
assert.deepEqual(
931+
(event as IncrementalIndexEventContent).invalidations,
932+
[`${testRealm2URL}Person/${id}`],
933+
);
926934
} else {
927935
assert.ok(
928936
false,

0 commit comments

Comments
 (0)