Skip to content

Instantly share code, notes, and snippets.

@mjstewart
mjstewart / assertion.daml
Created September 8, 2019 05:17
assert scenario fails with the expected error message
daml 1.2
module Demo where
template Loan
with
owner : Party
where
signatory owner
controller owner can
@mjstewart
mjstewart / keys.daml
Last active July 30, 2019 21:33
contractkeys
daml 1.2
module ContractKeys where
type TodoKey = (Text, Party, Party, Party)
data Content = Content with
maintainer1 : Party
maintainer2 : Party
maintainer3 : Party
category : Text
daml 1.2
module BDD (
ScenarioDescription
, describe
, it
, context
, pending
, pendingWith
) where
@mjstewart
mjstewart / airline
Created July 23, 2019 21:38
daml airline
daml 1.2
module Airline where
import DA.Assert
import DA.List
import DA.Optional
import DA.Next.Map as M
data SeatClass
= Economy
[user]
name = "your name"
email = "me@email.com"
[web]
browser = google-chrome
[core]
editor = vim
@mjstewart
mjstewart / GlobalErrorMatchers.java
Created March 31, 2018 00:28
Global error matching for Spring testing since ModelResultMatchers does not include it
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.ResultMatcher;
import org.springframework.validation.BindingResult;
import org.springframework.web.servlet.ModelAndView;
import java.util.Arrays;
import static org.springframework.test.util.AssertionErrors.assertTrue;
import static org.springframework.test.util.AssertionErrors.fail;
export enum AsyncActionType {
GET_ALL_TODO_REQUEST = 'todo/GET_ALL_TODO_REQUEST',
GET_ALL_TODO_SUCCESS = 'todo/GET_ALL_TODO_SUCCESS',
GET_ALL_TODO_ERROR = 'todo/GET_ALL_TODO_ERROR',
}
export type Action =
GetAllTodo.ApiRequest
| GetAllTodo.ApiSuccess
| GetAllTodo.ApiError