Skip to content

Commit 3865a6c

Browse files
authored
Merge pull request nteract#1022 from lgeiger/appveyor
chore(ci): Fix windows unit tests
2 parents d4cd383 + e441873 commit 3865a6c

File tree

4 files changed

+48
-29
lines changed

4 files changed

+48
-29
lines changed

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ install:
1515
test_script:
1616
- node --version
1717
- npm --version
18+
- npm test

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"test:functional:launchNewNotebook": "npm run sublaunch -- test/main/launchNewNotebook.js",
2525
"test:functional": "npm run test:functional:launch && npm run test:functional:launchNewNotebook",
2626
"test:coverage": "npm run coverage",
27-
"test:unit": "cross-env NODE_PATH=app/node_modules/ mocha -r test/setup.js --compilers js:babel-core/register 'test/renderer/**/*.js'",
27+
"test:unit": "cross-env NODE_PATH=app/node_modules/ mocha -r test/setup.js --compilers js:babel-core/register test/renderer/**/*.js",
2828
"test:unit:individual": "cross-env NODE_PATH=app/node_modules/ mocha -r test/setup.js --compilers js:babel-core/register ",
2929
"test:watch": "watch 'npm run test' test/",
3030
"test:lint": "npm run lint",

test/renderer/epics/loading-spec.js

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,44 +15,57 @@ import {
1515

1616
import Immutable from 'immutable';
1717

18+
const path = require('path');
19+
1820
describe('load', () => {
19-
expect(load('mytest.ipynb')).to.deep.equal({ type: 'LOAD', filename: 'mytest.ipynb' })
21+
it('loads a notebook', () => {
22+
expect(load('mytest.ipynb'))
23+
.to.deep.equal({ type: 'LOAD', filename: 'mytest.ipynb' })
24+
})
2025
})
2126

2227
describe('newNotebook', () => {
23-
expect(newNotebook('python3', '/tmp'))
24-
.to.deep.equal({
25-
type: 'NEW_NOTEBOOK',
26-
kernelSpecName: 'python3',
27-
cwd: '/tmp',
28-
})
28+
it('creates a new notebook', () => {
29+
expect(newNotebook('python3', '/tmp'))
30+
.to.deep.equal({
31+
type: 'NEW_NOTEBOOK',
32+
kernelSpecName: 'python3',
33+
cwd: '/tmp',
34+
})
35+
})
2936
})
3037

3138
describe('notebookLoaded', () => {
32-
expect(notebookLoaded('test', dummyCommutable))
33-
.to.deep.equal({
34-
type: 'SET_NOTEBOOK',
35-
filename: 'test',
36-
notebook: dummyCommutable,
37-
})
39+
it('sets a notebook', () => {
40+
expect(notebookLoaded('test', dummyCommutable))
41+
.to.deep.equal({
42+
type: 'SET_NOTEBOOK',
43+
filename: 'test',
44+
notebook: dummyCommutable,
45+
})
46+
})
3847
})
3948

4049
describe('extractNewKernel', () => {
41-
expect(extractNewKernel('/tmp/test.ipynb', dummyCommutable)).to.deep.equal({
42-
type: 'LAUNCH_KERNEL',
43-
kernelSpecName: 'python3',
44-
cwd: '/tmp',
50+
it('extracts and launches the kernel from a notebook', () => {
51+
expect(extractNewKernel('/tmp/test.ipynb', dummyCommutable)).to.deep.equal({
52+
type: 'LAUNCH_KERNEL',
53+
kernelSpecName: 'python3',
54+
cwd: path.resolve('/tmp'),
55+
})
4556
})
4657
})
4758

4859
describe('convertRawNotebook', () => {
49-
const converted = convertRawNotebook({
50-
filename: '/tmp/test.ipynb',
51-
data: dummy,
52-
});
53-
expect(converted.filename).to.equal('/tmp/test.ipynb');
54-
55-
const notebook = converted.notebook;
56-
expect(dummyCommutable.get('metadata').equals(notebook.get('metadata')))
57-
.to.be.true;
60+
it('converts a raw notebook', () => {
61+
const converted = convertRawNotebook({
62+
filename: '/tmp/test.ipynb',
63+
data: dummy,
64+
});
65+
expect(converted.filename).to.equal('/tmp/test.ipynb');
66+
67+
const notebook = converted.notebook;
68+
expect(dummyCommutable.get('metadata').equals(notebook.get('metadata')))
69+
.to.be.true;
70+
})
5871
})

test/renderer/native-window-spec.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@ describe('tildify', () => {
2929
expect(nativeWindow.tildify()).to.equal('');
3030
});
3131
it('replaces the user directory with ~', () => {
32-
const result = nativeWindow.tildify(path.join(remote.app.getPath('home'), 'test-notebooks'));
33-
expect(result).to.have.string('~');
32+
const fixture = path.join(remote.app.getPath('home'), 'test-notebooks');
33+
const result = nativeWindow.tildify(fixture);
34+
if (process.platform === 'win32') {
35+
expect(result).to.equal(fixture);
36+
} else {
37+
expect(result).to.have.string('~');
38+
}
3439
});
3540
});
3641

0 commit comments

Comments
 (0)