Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jacobsapps/c7eab6d6a35fc7f94462ed4ccaf73224 to your computer and use it in GitHub Desktop.

Select an option

Save jacobsapps/c7eab6d6a35fc7f94462ed4ccaf73224 to your computer and use it in GitHub Desktop.
struct MockWebsocketService: WebSocketService {
let publisher: AnyPublisher<Data, Error>
init(characters: [GameState.GameCharacter]) {
let state = GameState(characters: characters)
let data = try! JSONEncoder().encode(state)
self.publisher = Just(data)
.setFailureType(to: Error.self)
.eraseToAnyPublisher()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment