Skip to content

Commit db149df

Browse files
schmidt-sebastianmsasikanth
authored andcommitted
Add test for NoDocument assert (firebase#861)
1 parent 569a3c1 commit db149df

File tree

1 file changed

+370
-0
lines changed

1 file changed

+370
-0
lines changed

firebase-firestore/src/test/resources/json/limbo_spec_test.json

Lines changed: 370 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,6 +2248,376 @@
22482248
}
22492249
]
22502250
},
2251+
"Failed limbo resolution removes document from view": {
2252+
"describeName": "Limbo Documents:",
2253+
"itName": "Failed limbo resolution removes document from view",
2254+
"tags": [],
2255+
"config": {
2256+
"useGarbageCollection": true,
2257+
"numClients": 1
2258+
},
2259+
"steps": [
2260+
{
2261+
"userListen": [
2262+
2,
2263+
{
2264+
"path": "collection",
2265+
"filters": [
2266+
[
2267+
"matches",
2268+
"==",
2269+
true
2270+
]
2271+
],
2272+
"orderBys": []
2273+
}
2274+
],
2275+
"expectedState": {
2276+
"activeTargets": {
2277+
"2": {
2278+
"query": {
2279+
"path": "collection",
2280+
"filters": [
2281+
[
2282+
"matches",
2283+
"==",
2284+
true
2285+
]
2286+
],
2287+
"orderBys": []
2288+
},
2289+
"resumeToken": ""
2290+
}
2291+
}
2292+
}
2293+
},
2294+
{
2295+
"watchAck": [
2296+
2
2297+
]
2298+
},
2299+
{
2300+
"watchEntity": {
2301+
"docs": [
2302+
{
2303+
"key": "collection/a",
2304+
"version": 1000,
2305+
"value": {
2306+
"matches": true
2307+
},
2308+
"options": {
2309+
"hasLocalMutations": false,
2310+
"hasCommittedMutations": false
2311+
}
2312+
}
2313+
],
2314+
"targets": [
2315+
2
2316+
]
2317+
}
2318+
},
2319+
{
2320+
"watchCurrent": [
2321+
[
2322+
2
2323+
],
2324+
"resume-token-1000"
2325+
]
2326+
},
2327+
{
2328+
"watchSnapshot": {
2329+
"version": 1000,
2330+
"targetIds": []
2331+
},
2332+
"expectedSnapshotEvents": [
2333+
{
2334+
"query": {
2335+
"path": "collection",
2336+
"filters": [
2337+
[
2338+
"matches",
2339+
"==",
2340+
true
2341+
]
2342+
],
2343+
"orderBys": []
2344+
},
2345+
"added": [
2346+
{
2347+
"key": "collection/a",
2348+
"version": 1000,
2349+
"value": {
2350+
"matches": true
2351+
},
2352+
"options": {
2353+
"hasLocalMutations": false,
2354+
"hasCommittedMutations": false
2355+
}
2356+
}
2357+
],
2358+
"errorCode": 0,
2359+
"fromCache": false,
2360+
"hasPendingWrites": false
2361+
}
2362+
]
2363+
},
2364+
{
2365+
"userPatch": [
2366+
"collection/a",
2367+
{
2368+
"modified": true
2369+
}
2370+
],
2371+
"expectedSnapshotEvents": [
2372+
{
2373+
"query": {
2374+
"path": "collection",
2375+
"filters": [
2376+
[
2377+
"matches",
2378+
"==",
2379+
true
2380+
]
2381+
],
2382+
"orderBys": []
2383+
},
2384+
"modified": [
2385+
{
2386+
"key": "collection/a",
2387+
"version": 1000,
2388+
"value": {
2389+
"matches": true,
2390+
"modified": true
2391+
},
2392+
"options": {
2393+
"hasLocalMutations": true,
2394+
"hasCommittedMutations": false
2395+
}
2396+
}
2397+
],
2398+
"errorCode": 0,
2399+
"fromCache": false,
2400+
"hasPendingWrites": true
2401+
}
2402+
]
2403+
},
2404+
{
2405+
"userUnlisten": [
2406+
2,
2407+
{
2408+
"path": "collection",
2409+
"filters": [
2410+
[
2411+
"matches",
2412+
"==",
2413+
true
2414+
]
2415+
],
2416+
"orderBys": []
2417+
}
2418+
],
2419+
"expectedState": {
2420+
"activeTargets": {}
2421+
}
2422+
},
2423+
{
2424+
"userListen": [
2425+
4,
2426+
{
2427+
"path": "collection",
2428+
"filters": [],
2429+
"orderBys": []
2430+
}
2431+
],
2432+
"expectedState": {
2433+
"activeTargets": {
2434+
"4": {
2435+
"query": {
2436+
"path": "collection",
2437+
"filters": [],
2438+
"orderBys": []
2439+
},
2440+
"resumeToken": ""
2441+
}
2442+
}
2443+
},
2444+
"expectedSnapshotEvents": [
2445+
{
2446+
"query": {
2447+
"path": "collection",
2448+
"filters": [],
2449+
"orderBys": []
2450+
},
2451+
"added": [
2452+
{
2453+
"key": "collection/a",
2454+
"version": 1000,
2455+
"value": {
2456+
"matches": true,
2457+
"modified": true
2458+
},
2459+
"options": {
2460+
"hasLocalMutations": true,
2461+
"hasCommittedMutations": false
2462+
}
2463+
}
2464+
],
2465+
"errorCode": 0,
2466+
"fromCache": true,
2467+
"hasPendingWrites": true
2468+
}
2469+
]
2470+
},
2471+
{
2472+
"watchAck": [
2473+
4
2474+
]
2475+
},
2476+
{
2477+
"watchEntity": {
2478+
"docs": [],
2479+
"targets": [
2480+
4
2481+
]
2482+
}
2483+
},
2484+
{
2485+
"watchCurrent": [
2486+
[
2487+
4
2488+
],
2489+
"resume-token-1001"
2490+
]
2491+
},
2492+
{
2493+
"watchSnapshot": {
2494+
"version": 1001,
2495+
"targetIds": []
2496+
},
2497+
"expectedSnapshotEvents": [
2498+
{
2499+
"query": {
2500+
"path": "collection",
2501+
"filters": [],
2502+
"orderBys": []
2503+
},
2504+
"errorCode": 0,
2505+
"fromCache": false,
2506+
"hasPendingWrites": true
2507+
}
2508+
]
2509+
},
2510+
{
2511+
"failWrite": {
2512+
"error": {
2513+
"code": 9
2514+
}
2515+
},
2516+
"expectedState": {
2517+
"userCallbacks": {
2518+
"acknowledgedDocs": [],
2519+
"rejectedDocs": [
2520+
"collection/a"
2521+
]
2522+
},
2523+
"limboDocs": [
2524+
"collection/a"
2525+
],
2526+
"activeTargets": {
2527+
"1": {
2528+
"query": {
2529+
"path": "collection/a",
2530+
"filters": [],
2531+
"orderBys": []
2532+
},
2533+
"resumeToken": ""
2534+
},
2535+
"4": {
2536+
"query": {
2537+
"path": "collection",
2538+
"filters": [],
2539+
"orderBys": []
2540+
},
2541+
"resumeToken": ""
2542+
}
2543+
}
2544+
},
2545+
"expectedSnapshotEvents": [
2546+
{
2547+
"query": {
2548+
"path": "collection",
2549+
"filters": [],
2550+
"orderBys": []
2551+
},
2552+
"modified": [
2553+
{
2554+
"key": "collection/a",
2555+
"version": 1000,
2556+
"value": {
2557+
"matches": true
2558+
},
2559+
"options": {
2560+
"hasLocalMutations": false,
2561+
"hasCommittedMutations": false
2562+
}
2563+
}
2564+
],
2565+
"errorCode": 0,
2566+
"fromCache": true,
2567+
"hasPendingWrites": false
2568+
}
2569+
]
2570+
},
2571+
{
2572+
"watchRemove": {
2573+
"targetIds": [
2574+
1
2575+
],
2576+
"cause": {
2577+
"code": 7
2578+
}
2579+
},
2580+
"expectedState": {
2581+
"activeTargets": {
2582+
"4": {
2583+
"query": {
2584+
"path": "collection",
2585+
"filters": [],
2586+
"orderBys": []
2587+
},
2588+
"resumeToken": ""
2589+
}
2590+
},
2591+
"limboDocs": []
2592+
},
2593+
"expectedSnapshotEvents": [
2594+
{
2595+
"query": {
2596+
"path": "collection",
2597+
"filters": [],
2598+
"orderBys": []
2599+
},
2600+
"removed": [
2601+
{
2602+
"key": "collection/a",
2603+
"version": 1000,
2604+
"value": {
2605+
"matches": true
2606+
},
2607+
"options": {
2608+
"hasLocalMutations": false,
2609+
"hasCommittedMutations": false
2610+
}
2611+
}
2612+
],
2613+
"errorCode": 0,
2614+
"fromCache": false,
2615+
"hasPendingWrites": false
2616+
}
2617+
]
2618+
}
2619+
]
2620+
},
22512621
"Limbo docs are resolved by primary client": {
22522622
"describeName": "Limbo Documents:",
22532623
"itName": "Limbo docs are resolved by primary client",

0 commit comments

Comments
 (0)