Files
dolt/integration-tests/mysql-client-tests/node/workbenchTests/branches.js
T

93 lines
2.2 KiB
JavaScript

import { branchesMatcher } from "./matchers.js";
import { getArgs } from "../helpers.js";
const args = getArgs();
export const branchTests = [
{
q: `CALL DOLT_BRANCH(:newBranchName, :fromRefName)`,
p: { newBranchName: "mybranch", fromRefName: "main" },
res: [{ status: 0 }],
},
{
q: `USE ::dbName`,
p: { dbName: `${args.dbName}/mybranch` },
res: {
fieldCount: 0,
affectedRows: 0,
insertId: 0,
info: "",
serverStatus: 2,
warningStatus: 0,
},
},
{
q: "create table test (pk int, `value` int, primary key(pk))",
res: {
fieldCount: 0,
affectedRows: 0,
insertId: 0,
info: "",
serverStatus: 2,
warningStatus: 0,
},
},
{
q: `CALL DOLT_COMMIT("-A", "-m", :commitMsg, "--author", :authorName)`,
p: {
commitMsg: "Create table test",
authorName: "Dolt <dolt@dolthub.com>",
},
res: [{ hash: "" }],
},
{
q: `SELECT * FROM dolt_branches WHERE name NOT LIKE "workspaces/%" LIMIT 200`,
res: [
{
name: "main",
latest_committer: "Taylor Bantle",
latest_committer_email: "taylor@liquidata.co",
// TODO: uncomment
// latest_committer: "mysql-test-runner",
// latest_committer_email: "mysql-test-runner@liquidata.co",
},
{
name: "mybranch",
latest_committer: "Dolt",
latest_committer_email: "dolt@dolthub.com",
},
],
matcher: branchesMatcher,
},
{
q: `CALL DOLT_CHECKOUT("-b", :branchName)`,
p: { branchName: "branch-to-delete" },
res: [{ status: 0 }],
},
{
q: `SELECT COUNT(*) FROM dolt_branches WHERE name NOT LIKE "workspaces/%" LIMIT 200`,
res: [{ ["COUNT(*)"]: 3 }],
},
{
q: `USE ::dbName`,
p: { dbName: `${args.dbName}/main` },
res: {
fieldCount: 0,
affectedRows: 0,
insertId: 0,
info: "",
serverStatus: 2,
warningStatus: 0,
},
},
{
q: `CALL DOLT_BRANCH("-D", :branchName)`,
p: { branchName: "branch-to-delete" },
res: [{ status: 0 }],
},
{
q: `SELECT COUNT(*) FROM dolt_branches WHERE name NOT LIKE "workspaces/%" LIMIT 200`,
res: [{ ["COUNT(*)"]: 2 }],
},
];