prettier-plugin-motoko icon indicating copy to clipboard operation
prettier-plugin-motoko copied to clipboard

Object auto-formatted into one very long line

Open ByronBecker opened this issue 2 years ago • 1 comments

In my tests, I had an object formatted such that each property was on a new line and then the formatter did this to it 😅

M.equals(testableItemGetTransactionsResult({ results = [{ timestamp = timestamp_1; customerId = Principal.fromText("aaaaa-aa"); transaction = #topup({ icpCharged = { e8s = 1 }; cyclesToppedUpWith = 1_000_000_000_000; canisterId = Principal.fromText("aaaaa-aa") }); transactionId = "0" }, { timestamp = timestamp_1; customerId = Principal.fromText("aaaaa-aa"); transaction = #topup({ icpCharged = { e8s = 2 }; cyclesToppedUpWith = 2_000_000_000_000; canisterId = Principal.fromText("aaaaa-aa") }); transactionId = "1" }, { timestamp = timestamp_2; customerId = Principal.fromText("aaaaa-aa"); transaction = #topup({ icpCharged = { e8s = 3 }; cyclesToppedUpWith = 3_000_000_000_000; canisterId = Principal.fromText("aaaaa-aa") }); transactionId = "2" }, { timestamp = timestamp_2; customerId = Principal.fromText("renrk-eyaaa-aaaaa-aaada-cai"); transaction = #topup({ icpCharged = { e8s = 4 }; cyclesToppedUpWith = 3_000_000_000_000; canisterId = Principal.fromText("aaaaa-aa") }); transactionId = "3" }]; nextKey = null })),

Here's some more context

// within a matchers suite
    test(
      "gets all transactions in the transaction history if the timestamp bounds and limit are sufficient",
      TransactionHistory.getTransactions(
        preseededTransactionHistory,
        timestamp_1 / 1_000_000,
        timestamp_2 / 1_000_000,
        10,
      ),
      M.equals(testableItemGetTransactionsResult({ results = [{ timestamp = timestamp_1; customerId = Principal.fromText("aaaaa-aa"); transaction = #topup({ icpCharged = { e8s = 1 }; cyclesToppedUpWith = 1_000_000_000_000; canisterId = Principal.fromText("aaaaa-aa") }); transactionId = "0" }, { timestamp = timestamp_1; customerId = Principal.fromText("aaaaa-aa"); transaction = #topup({ icpCharged = { e8s = 2 }; cyclesToppedUpWith = 2_000_000_000_000; canisterId = Principal.fromText("aaaaa-aa") }); transactionId = "1" }, { timestamp = timestamp_2; customerId = Principal.fromText("aaaaa-aa"); transaction = #topup({ icpCharged = { e8s = 3 }; cyclesToppedUpWith = 3_000_000_000_000; canisterId = Principal.fromText("aaaaa-aa") }); transactionId = "2" }, { timestamp = timestamp_2; customerId = Principal.fromText("renrk-eyaaa-aaaaa-aaada-cai"); transaction = #topup({ icpCharged = { e8s = 4 }; cyclesToppedUpWith = 3_000_000_000_000; canisterId = Principal.fromText("aaaaa-aa") }); transactionId = "3" }]; nextKey = null })),
    ),

ByronBecker avatar Mar 01 '23 18:03 ByronBecker

Yeah, that doesn't look right, haha. I'll take a look at this when I get a chance after ETHDenver.

rvanasa avatar Mar 01 '23 20:03 rvanasa