Giter Club home page Giter Club logo

test's People

Contributors

skilesare avatar zenvoich avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

test's Issues

Timer support?

Is there a way I can run some code that will set a timer without an error?
I have some code that kicks off a timer (dont care about it for the test) and i get this error
FAIL internals:604:11: execution error, Value.prim: global_timer_set

Maybe some sort of mock, or just ignore the timer? what are my options

Overwriting/mocking stable vars

I have an actor class which looks like this

actor class Orchestrator() = this {
    let { phash } = Map;

    private stable var pool = Map.new<Principal, Types.CanisterInfo>();

    let management = Management.service(Constants.ManagementCanisterId);
    
    // Auth so that only server and admin can talk to this canister
    let admin = Principal.fromText("qcjer-cl7l3-dae");
    let game_controller = Principal.fromText("7k7-lqlgk-x56ep");
    private stable var admins = Vector.fromArray<Principal>([admin, game_controller]);

I then have some tests which look like this

var orchestrator = await Orchestrator();

let caller : Principal = Principal.fromText("wo5qg-ysjiq-5da");

let user1 : Principal = Principal.fromText("kufey-x4r");
let user2 : Principal = Principal.fromText("mm6ly-2yowe");
let user3 : Principal = Principal.fromText("wkvns-5prta");
var admins : Vector<Principal> = Vector.fromArray([caller, user1, user2]);

func resetMocks() : () {
  admins := Vector.fromArray([caller, user1, user2]);
};


await suite(
  "createEvent",
  func() : async () {
    await test(
      "setEventWasm works correctly",
      func() : async () {
        resetMocks();


        let oldEventWasm = await orchestrator.getEventWasm();

The getEventWasm function requires admin verification so i need to change the admins in my Orchestrator actor class to include this principal wo5qg-ysjiq-5da. have you got a good way of suggesting how I do this? I could pass it as an argument to my actor orchestrator class when i create it i suppose but i was wondering if there might be a better way to do it

Typo in Code Snippet in readme.md for expect.option Example

I've noticed a small typo in the readme.md file, specifically in the code snippet provided for expect.option. The typo is in the variable name used in the example for an optional custom type. The variable is declared as "val", but later referenced as "v". This might cause confusion for users trying to understand or run the example code.

expect.option

  // ... previous code ...
  
  let val = ?{x = 1; y = 2};
  
  expect.option(v, showMyType, equalMyType).notEqual(null);
  expect.option(v, showMyType, equalMyType).isSome(); // != null
  expect.option(v, showMyType, equalMyType).equal(?{x = 1; y = 2});

Assert with error message?

Is there way to run a test and have it print out details?
If i use Debug.trap, i get a message but its stop execution of the other tests
Do I just do and if statement, then Debug.print, then assert false?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.