Skip to content

Commit 55fcfd1

Browse files
authored
Use substring instead of substr (#42)
1 parent f66ad6a commit 55fcfd1

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

tests/gui/index.html.test.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
import puppeteer from 'puppeteer'
22

33
describe('index', () => {
4-
let browser
4+
let browser, page
55
beforeAll(async () => {
66
browser = await puppeteer.launch({
77
args: ['--no-sandbox'],
88
})
9+
page = await browser.newPage()
10+
await page.goto(`http://${process.env.SERVER_HOST}/`)
11+
page.on('console', message => console.log(`${message.type().substring(0, 3).toUpperCase()} ${message.text()}`))
12+
.on('pageerror', ({ message }) => console.log(message))
13+
.on('requestfailed', request => console.log(`${request.failure().errorText} ${request.url()}`))
914
})
1015

1116
afterAll(async () => {
1217
await browser.close()
1318
})
1419

1520
test('default inputs', async () => {
16-
const page = await browser.newPage()
17-
await page.goto(`http://${process.env.SERVER_HOST}/`)
18-
page.on('console', message => console.log(`${message.type().substr(0, 3).toUpperCase()} ${message.text()}`))
19-
.on('pageerror', ({ message }) => console.log(message))
20-
.on('requestfailed', request => console.log(`${request.failure().errorText} ${request.url()}`))
2121
await expect(page.title()).resolves.toMatch('AI on Browser')
2222
const dataSelectBox = await page.waitForSelector('#ml_selector dl:first-child dd:nth-child(2) select')
2323
const dataName = await (await dataSelectBox.getProperty('value')).jsonValue()
@@ -33,11 +33,6 @@ describe('index', () => {
3333
}, 20000)
3434

3535
test('ai manager', async () => {
36-
const page = await browser.newPage()
37-
await page.goto(`http://${process.env.SERVER_HOST}/`)
38-
page.on('console', message => console.log(`${message.type().substr(0, 3).toUpperCase()} ${message.text()}`))
39-
.on('pageerror', ({ message }) => console.log(message))
40-
.on('requestfailed', request => console.log(`${request.failure().errorText} ${request.url()}`))
4136
await expect(page.title()).resolves.toMatch('AI on Browser')
4237
await page.waitForSelector('#data_menu > *')
4338

tests/lib/util/matrix.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2954,7 +2954,7 @@ describe('Matrix', () => {
29542954

29552955
test('copy', () => {
29562956
const mat = Matrix.randn(100, 10)
2957-
const cp = mat['copy' + name[0].toUpperCase() + name.substr(1)](2)
2957+
const cp = mat['copy' + name[0].toUpperCase() + name.substring(1)](2)
29582958
for (let i = 0; i < mat.rows; i++) {
29592959
for (let j = 0; j < mat.cols; j++) {
29602960
expect(cp.at(i, j)).toBe(info.calc(mat.at(i, j), 2))

0 commit comments

Comments
 (0)