Skip to content

Instantly share code, notes, and snippets.

@apoorv-2204
Last active March 1, 2022 08:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apoorv-2204/fc49ae6cf3a711c5be97430b9e2221da to your computer and use it in GitHub Desktop.
Save apoorv-2204/fc49ae6cf3a711c5be97430b9e2221da to your computer and use it in GitHub Desktop.
elixir
Anti-pattern
https://stackoverflow.com/questions/980601/what-is-an-anti-pattern

Mox is Mock Test library

Mock test is treated as a noun instad of verb In Ex testing

-not be used as ad-hoc , but only where there is behaviour -simulates external entities api,etc -requires @type @callbacks -requires to define a behaviour

defmodule ArchEthic.Metrics.Pollers_test do use ExUnit.Case, async: true

alias ArchEthic.Metrics.Poller

describe "" do

test "Listless.list/0 returns an empty list" do

{:ok, pid} = start_supervised(ArchEthic.Metrics.Poller)

end

end

end

function of poller:

initialization

default state

periodic_metric_aggregation

monitor live view procces & store there pid

live view proces down

periodic_calculation_of_points

get new data

testing guidlines :operation and state

use of dynamic data rather than using the static data

use of pin operator for that--

check for the core logic/concept is working or not

tests should work even if we change the internal state representation or either code

move all the pure data structure logic to other modules

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