# All files / src/utils mocks.js

100% Statements 8/8
100% Branches 0/0
100% Functions 1/1
100% Lines 8/8

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    7x
    7x
    7x
    7x

    7x
    15x
    15x

    15x

     // @flow
    import Context from "../parser/context";
    import TokenStream from "../utils/token-stream";
    import Tokenizer from "../tokenizer";
    import Stream from "./stream";

    export const mockContext = (code: string): Context => {
      const stream = new Stream(code);
      const tokens = new TokenStream(new Tokenizer(stream).parse());

      return new Context({
        body: [],
        diAssoc: "right",
        stream: tokens,
        token: tokens.next(),
        lines: stream.lines,
        globals: [],
        functions: [],
        filename: "mockContext.walt",
      });
    };