aboutsummaryrefslogtreecommitdiff
path: root/javascript/tests/acceptance/haskell-module-test.js
blob: 939c0ddb7ce0597e4301bf6de141bce0deaa2f01 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { module, test } from 'qunit';
import { visit, currentURL, find } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';


module('Acceptance | haskell-module', function(hooks) {
  setupApplicationTest(hooks);
  
  //Test data is in 'server/mocks/packages.js'
  test('visiting /package/test-package-0.1.0.0/show/app/Main.hs', async function(assert) {
    await visit('/package/test-package-0.1.0.0/show/app/Main.hs');
    
    assert.equal(currentURL(), '/package/test-package-0.1.0.0/show/app/Main.hs');
    
    const lines = Array.from(find('tbody').children).map((tr) => {
      return tr.children[1].innerText;
    });
        
    assert.deepEqual(lines,["module Main where",
                           "",
                           "import Lib",
                           "",
                           "main :: IO ()",
                           "main = someFunc",
                           "",
                           ""]);
  });
});