This repository was archived by the owner on Mar 23, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +42
-24
lines changed Expand file tree Collapse file tree 3 files changed +42
-24
lines changed Original file line number Diff line number Diff line change
1
+ import { createActors } from "../../../lib_sdk/create_actors" ;
2
+
3
+ setTimeout ( function ( ) {
4
+ describe ( "cnd can be restarted" , function ( ) {
5
+ this . timeout ( 60000 ) ;
6
+ it ( "after the swap was accepted" , async function ( ) {
7
+ const { alice, bob } = await createActors (
8
+ "cnd_can_be_restarted.log"
9
+ ) ;
10
+
11
+ await alice . sendRequest ( ) ;
12
+ await bob . accept ( ) ;
13
+
14
+ await alice . currentSwapIsAccepted ( ) ;
15
+ await bob . currentSwapIsAccepted ( ) ;
16
+
17
+ await alice . restart ( ) ;
18
+ await bob . restart ( ) ;
19
+
20
+ await alice . currentSwapIsAccepted ( ) ;
21
+ await bob . currentSwapIsAccepted ( ) ;
22
+ } ) ;
23
+ } ) ;
24
+ run ( ) ;
25
+ } , 0 ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import "../../lib/setup_chai";
10
10
import { Asset , AssetKind } from "../asset" ;
11
11
import { CndInstance } from "../cnd_instance" ;
12
12
import { Ledger , LedgerKind } from "../ledger" ;
13
+ import { sleep } from "../utils" ;
13
14
import { Wallets } from "../wallets" ;
14
15
import { Actors } from "./index" ;
15
16
@@ -186,12 +187,24 @@ export class Actor {
186
187
await this . swap . redeem ( Actor . defaultActionConfig ) ;
187
188
}
188
189
189
- public async assertHasNoSwaps ( ) {
190
- this . logger . debug ( "Checking if we have 0 swaps" ) ;
190
+ public async currentSwapIsAccepted ( ) {
191
+ let swapEntity ;
191
192
192
- const swaps = await this . cnd . getSwaps ( ) ;
193
+ do {
194
+ swapEntity = await this . swap . getEntity ( ) ;
193
195
194
- expect ( swaps ) . to . have . length ( 0 ) ;
196
+ await sleep ( 200 ) ;
197
+ } while (
198
+ swapEntity . properties . state . communication . status !== "ACCEPTED"
199
+ ) ;
200
+ }
201
+
202
+ public async assertHasCurrentSwap ( ) {
203
+ this . logger . debug ( "Checking if we can fetch the current swap" ) ;
204
+
205
+ const response = await this . cnd . fetch ( this . swap . self ) ;
206
+
207
+ return response ;
195
208
}
196
209
197
210
public async assertSwapped ( ) {
You can’t perform that action at this time.
0 commit comments