JeongAh Hong
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    @leejun6694 # Step1-1 PR 쿠마 안녕하세요! Step1이 아닌 Step1-1 PR을 보냅니다! 😅 ## 궁금한 점 ### 0. Mock 객체 구현을 맞게 했는지 궁금합니다. 네트워크와 통신하는 타입 NetworkManager를 구현했습니다. - 그리고 URLSession의 Mock 객체를 만들어 NetworkManager에서 데이터를 받아오도록 했습니다. - Mock 객체는 items url인지 item url인지에 따라 해당하는 JSON파일을 넘겨주도록 했습니다. - 그리고 여기서 url과 JSON파일은 저희가 임의로 매칭했습니다. (items/1 로 끝나는 url이 들어오면 Items.json을, item/1로 끝나는 url이 들어오면 Item.json을 전달) ### 1. Model NetworkManager와 JSOnParser 타입은 Model일까요, Controller일까요? Soll은 Model 이라고 생각하고(데이터를 가공해서 Controller에서 호출되는 것이니까), Joey는 둘 다 아니라고 생각했어요. 쿠마는 어떻게 생각하시나요? ### 2. Test 대상을 다른 대상의 Test에 사용해야하는 경우 #### 예전 PR 피드백 질의응답 > `dequeue()`나 `clear()`를 테스트하기 위해서 `enqueue(_:)`를 통해 값을 세팅해주는데요,이럴 때 `enqueue(_:)`가 항상 성공할거라는 보장을 얻을 수 있나요? 이 메서드가 실패하면연쇄적으로 테스트가 실패할텐데, 이를 방지하고자 하는 방법이 있을까요? [깃헙](https://github.com/yagom-academy/ios-bank-manager/pull/70) 쿠마: 반대로 말하면 이런 메서드가 실패할 수 있을지 확인하기 위해, 우리가 테스트 코드를 짜고 있을 수도 있겠네요ㅎㅎ 이를 방지하기 위해선 enqueue method 에 에러 처리가 필요하겠네요...!? 저도 좀 더 생각해보겠습니다! #### 이번 고민 내용 `fetchData()` 에서 `parse()` 를 사용하고 있는데 저번처럼 하나의 테스트가 다른 테스트를 품고있다고 생각이 들어서요. 혹시 더 좋은 방법이 있을까요? ### 3. 하드코딩 관련 테스트 코드에서 String 타입도 상수로 저장해서 사용하는 것이 좋을까요? ```swift let testData = try XCTUnwrap(NSDataAsset(name: "Items")?.data) ``` ### 4. 접근 제어자 리팩토링을 하는 과정에서 은닉화를 위해 프로퍼티와 메서드들에 private을 붙여주려고 했는데요, NetworkManager의 프로퍼티와 메서드를 테스트 코드에서 접근해서 사용을 하고 있더라구요. ### 5. deprecated init()을 사용해도 되나요? - 아래처럼 MockURLSessionDataTask가 URLSessionDataTask를 상속받는 경우 `override init()` 이 deprecated init이라는 경고가 떴습니다. ```swift class MockURLSessionDataTask: URLSessionDataTask { override init() {} var resumeDidCall: () -> Void = {} override func resume() { resumeDidCall() } } ``` - 작동이 되긴하지만 조금 찝찝해서 아래와 같이 구현했습니다. 다만 이 경우 URLSessionProtocol과 URLSession의 dataTask() 메서드까지 수정해줘야하는 번거로움이 있었습니다. - Q. 위 방식과 다음 방식 중 어느 것이 나은지, deprecated init()은 사용해도 되는 것인지 쿠마의 조언을 구하고 싶습니다 🤓 ```swift class MockURLSessionDataTask: URLSessionDataTaskProtocol { var resumeDidCall: () -> Void = {} func resume() { resumeDidCall() } } ``` ```swift protocol URLSessionProtocol { func dataTaskWithRequest(with request: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTaskProtocol } extension URLSession: URLSessionProtocol { func dataTaskWithRequest(with request: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTaskProtocol { dataTask(with: request, completionHandler: completionHandler) as URLSessionDataTaskProtocol } } ``` # 잘 부탁드립니다 🤩 🙏 🥳

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully