dimanche 29 janvier 2017

AVA testing gives undefined when importing to test.js

I am using AVA as testing with node and javascript.

On test.js

import test from 'ava';
import {valid, output, input} from './dependency.js';

test("Input is not a Empty String", t => {
    t.not(input, ''); t.pass();
})

test("Correct output", t => {
    var testInput = ['KittenService: CameCaser', 'CamelCaser: '];
    var expected = 'CamelCaser, KittenService';
    var actual = output;
    t.deepEqual(actual, expected, "Result did match");
})

On first test it passes even though my

var input = '';

Also on my second test it throws:

t.deepEqual(actual, expected, "Result did match")
              |       |
              |       "CamelCaser, KittenService"
              undefined

on dependency.js

module.exports = {valid, input, output};
var input = '';
var output = [];

I do have value of output after function but it seems like on test.js it doesn't take either input or output value from dependency test. I am not exactly sure how to fix this problem.

Aucun commentaire:

Enregistrer un commentaire