fix unit tests for new message type
This commit is contained in:
		
							parent
							
								
									6b828b2574
								
							
						
					
					
						commit
						7d6f99505a
					
				
					 4 changed files with 30 additions and 6 deletions
				
			
		
							
								
								
									
										21
									
								
								LICENSE
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								LICENSE
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,21 @@ | |||
| The MIT License (MIT)  | ||||
| 
 | ||||
| Copyright (C) 2024 team@cyberconcepts.org | ||||
| 
 | ||||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
| of this software and associated documentation files (the "Software"), to deal | ||||
| in the Software without restriction, including without limitation the rights | ||||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
| copies of the Software, and to permit persons to whom the Software is | ||||
| furnished to do so, subject to the following conditions: | ||||
| 
 | ||||
| The above copyright notice and this permission notice shall be included in all | ||||
| copies or substantial portions of the Software. | ||||
| 
 | ||||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
| SOFTWARE. | ||||
							
								
								
									
										1
									
								
								mix.exs
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								mix.exs
									
										
									
									
									
								
							|  | @ -9,6 +9,7 @@ defmodule Scopes.MixProject do | |||
|       elixirc_paths: elixirc_paths(Mix.env()), | ||||
|       start_permanent: Mix.env() == :prod, | ||||
|       aliases: aliases(), | ||||
|       consolidate_protocols: Mix.env() != :test, | ||||
|       deps: deps() | ||||
|     ] | ||||
|   end | ||||
|  |  | |||
|  | @ -4,9 +4,11 @@ defmodule ScopesWeb.MessageLiveTest do | |||
|   import Phoenix.LiveViewTest | ||||
|   import Scopes.CoreFixtures | ||||
| 
 | ||||
|   @create_attrs %{data: %{}, domain: "some domain", item: "some item", action: "some action", class: "some class"} | ||||
|   @update_attrs %{data: %{}, domain: "some updated domain", item: "some updated item", action: "some updated action", class: "some updated class"} | ||||
|   @invalid_attrs %{data: nil, domain: nil, item: nil, action: nil, class: nil} | ||||
|   defimpl Phoenix.HTML.Safe, for: Map, do: (def to_iodata(%{}), do: "{}") | ||||
| 
 | ||||
|   @create_attrs %{domain: "some domain", item: "some item", action: "some action", class: "some class"} | ||||
|   @update_attrs %{domain: "some updated domain", item: "some updated item", action: "some updated action", class: "some updated class"} | ||||
|   @invalid_attrs %{domain: nil, item: nil, action: nil, class: nil} | ||||
| 
 | ||||
|   defp create_message(_) do | ||||
|     message = message_fixture() | ||||
|  | @ -14,7 +16,7 @@ defmodule ScopesWeb.MessageLiveTest do | |||
|   end | ||||
| 
 | ||||
|   describe "Index" do | ||||
|     setup [:create_message] | ||||
|     setup [:create_message, :register_and_log_in_user] | ||||
| 
 | ||||
|     test "lists all messages", %{conn: conn, message: message} do | ||||
|       {:ok, _index_live, html} = live(conn, ~p"/messages") | ||||
|  | @ -78,7 +80,7 @@ defmodule ScopesWeb.MessageLiveTest do | |||
|   end | ||||
| 
 | ||||
|   describe "Show" do | ||||
|     setup [:create_message] | ||||
|     setup [:create_message, :register_and_log_in_user] | ||||
| 
 | ||||
|     test "displays message", %{conn: conn, message: message} do | ||||
|       {:ok, _show_live, html} = live(conn, ~p"/messages/#{message}") | ||||
|  |  | |||
|  | @ -13,7 +13,7 @@ defmodule Scopes.CoreFixtures do | |||
|       |> Enum.into(%{ | ||||
|         action: "some action", | ||||
|         class: "some class", | ||||
|         data: %{}, | ||||
|         #data: %{}, | ||||
|         domain: "some domain", | ||||
|         item: "some item" | ||||
|       }) | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue