mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-25 17:04:16 +00:00
feature(user-menu) improve error handling
This commit is contained in:
parent
b8592d35c0
commit
64e6b8387a
5 changed files with 109 additions and 14 deletions
32
client/modules/user-menu/parse-error.spec.js
Normal file
32
client/modules/user-menu/parse-error.spec.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
'use strict';
|
||||
|
||||
const test = require('supertape');
|
||||
const parseError = require('./parse-error');
|
||||
|
||||
test('user-menu: parse-error', (t) => {
|
||||
const result = parseError({
|
||||
lineNumber: 1,
|
||||
columnNumber: 2,
|
||||
});
|
||||
|
||||
const expected = [1, 2];
|
||||
|
||||
t.deepEqual(result, expected);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('user-menu: parse-error', (t) => {
|
||||
const stack = `
|
||||
ReferenceError: s is not defined
|
||||
at eval (eval at module.exports (get-user-menu.js:NaN), <anonymous>:1:2)
|
||||
at module.exports (get-user-menu.js:6)
|
||||
at tryCatch (VM12611 try-catch.js:7)
|
||||
at AsyncFunction.show (index.js:67)
|
||||
`;
|
||||
|
||||
const result = parseError({stack});
|
||||
const expected = [1, 2];
|
||||
|
||||
t.deepEqual(result, expected);
|
||||
t.end();
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue