Skip to content

Commit e21578e

Browse files
committed
Fix CI tests
1 parent 712d428 commit e21578e

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

.github/workflows/nodejs.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ jobs:
1919
npx standard
2020
npm ci
2121
npm run build --if-present
22-
# TODO: Remove the next line when #539 is fixed.
23-
rm Linear-Algebra/test/test.js String/LevenshteinDistance.test.js
2422
npm test
2523
env:
2624
CI: true

Linear-Algebra/src/la_lib.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
The namespace LinearAlgebra contains useful classes and functions for dealing with
66
linear algebra under JavaScript.
77
*/
8-
var LinearAlgebra;
8+
let LinearAlgebra = {};
9+
910
(function (LinearAlgebra) {
1011
/*
1112
class: Vector
@@ -309,3 +310,5 @@ var LinearAlgebra;
309310
}()) // end of class Matrix
310311
LinearAlgebra.Matrix = Matrix
311312
})(LinearAlgebra || (LinearAlgebra = {})) // end of namespace LinearAlgebra
313+
314+
export default LinearAlgebra

Linear-Algebra/test/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var assert = require('assert')
1111
var fs = require('fs')
1212

1313
// file is included here
14-
eval(fs.readFileSync('src/la_lib.js') + '')
14+
import LinearAlgebra from '../src/la_lib.js';
1515
// Tests goes here
1616

1717
// creating some vectors

String/LevenshteinDistance.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ const levenshteinDistance = (a, b) => {
4848
return distanceMatrix[b.length][a.length]
4949
}
5050

51-
export { levenshteinDistance }
51+
export default levenshteinDistance

String/LevenshteinDistance.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import levenshteinDistance from './LevenshteinDistance'
1+
import levenshteinDistance from './LevenshteinDistance.js'
22

33
describe('levenshteinDistance', () => {
44
it('should calculate edit distance between two strings', () => {
@@ -14,13 +14,13 @@ describe('levenshteinDistance', () => {
1414
// Should just substitute i with o, m with g and insert e at end
1515
expect(levenshteinDistance('firm', 'forge')).toBe(3)
1616

17-
// Should just substitute i with s, g with i, h with t and delete f from front
18-
expect(levenshteinDistance('fighting', 'sitting')).toBe(4)
17+
// Should just substitute f with s, g with t and delete h
18+
expect(levenshteinDistance('fighting', 'sitting')).toBe(3)
1919

2020
// Should add 4 letters b, a, s and e at the beginning.
2121
expect(levenshteinDistance('ball', 'baseball')).toBe(4)
2222

2323
// Should delete 4 letters b, a, s and e at the beginning.
24-
expect(levenshteinDistance('baseball', 'foot')).toBe(4)
24+
expect(levenshteinDistance('baseball', 'ball')).toBe(4)
2525
})
2626
})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy