mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-05-27 03:10:11 +08:00
- 为 show dbs 和 show databases 转换 listDatabases JSON 命令 - 为 show collections 和 show tables 转换 listCollections JSON 命令 - 补充 Mongo shell 快捷命令回归测试并验证前端构建 Fixes #390
20 lines
692 B
TypeScript
20 lines
692 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { convertMongoShellToJsonCommand } from './mongodb';
|
|
|
|
describe('convertMongoShellToJsonCommand', () => {
|
|
it('converts show dbs shell shortcut to listDatabases command', () => {
|
|
expect(convertMongoShellToJsonCommand('show dbs;')).toEqual({
|
|
recognized: true,
|
|
command: JSON.stringify({ listDatabases: 1, nameOnly: true }),
|
|
});
|
|
});
|
|
|
|
it('converts show collections shell shortcut to listCollections command', () => {
|
|
expect(convertMongoShellToJsonCommand(' show collections ')).toEqual({
|
|
recognized: true,
|
|
command: JSON.stringify({ listCollections: 1, filter: {}, nameOnly: true }),
|
|
});
|
|
});
|
|
});
|