Skip to content

Conversation

@rogerluan
Copy link
Contributor

@rogerluan rogerluan commented Apr 6, 2021

Hey 👋

While trying out Mocker, I tried replicating the happy path (according to the README) and wasn't able to. .data instance variable doesn't exist in URL, so then I thought it was a deprecated API, which got replaced by dataRepresentation. Turns out that dataRepresentation is different than the internal var data: Data { try! Data(contentsOf: self) } utility declared in the unit tests 😄 and this difference was causing Mocker to always return empty Data in the callback.

(lldb) po try! Data(contentsOf: MockedData.notesJSON)
▿ 585 bytes
  - count : 585
  ▿ pointer : 0x00007fb7b425e990
    - pointerValue : 140426978126224

(lldb) po MockedData.notesJSON.dataRepresentation
▿ 186 bytes
  - count : 186
  ▿ pointer : 0x00007fb7b427d160
    - pointerValue : 140426978251104

So this PR aims to make things more explicit and correct, on the documentation end. On the unit test sample code project we can leave things as is imo, because it helps readability and anyone can jump to definition if they wish to inspect what data is about 👍

@wetransferplatform
Copy link
Collaborator

Messages
📖

View more details on Bitrise

📖 Mocker: Executed 25 tests, with 0 failures (0 unexpected) in 1.920 (1.944) seconds

Generated by 🚫 Danger Swift against 0d02a55

Copy link
Contributor

@AvdLee AvdLee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for bringing this up. Based on real experience for you as a user, this is super valuable. Hopefully, this will help making our project easier to understand for future users 💪 .

@AvdLee AvdLee merged commit 05b097b into WeTransfer:master Apr 7, 2021
@rogerluan rogerluan deleted the patch-1 branch April 7, 2021 12:54
@wetransferplatform
Copy link
Collaborator

Congratulations! 🎉 This was released as part of Release 2.5.3 🚀

Generated by GitBuddy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants