mirror of
https://github.com/ddworken/hishtory.git
synced 2025-08-17 18:31:43 +02:00
Prompt people if they run hishtory init and already have a bunch of entries + fix tests + add TODOs + add hishtory version to requests
This commit is contained in:
@ -203,7 +203,8 @@ func testIntegrationWithNewDevice(t *testing.T, tester shellTester) {
|
||||
}
|
||||
|
||||
// Set the secret key to the previous secret key
|
||||
out = tester.RunInteractiveShell(t, `hishtory init `+userSecret)
|
||||
out, err := tester.RunInteractiveShellRelaxed(t, `yes | hishtory init `+userSecret)
|
||||
shared.Check(t, err)
|
||||
if !strings.Contains(out, "Setting secret hishtory key to "+userSecret) {
|
||||
t.Fatalf("Failed to re-init with the user secret: %v", out)
|
||||
}
|
||||
@ -249,7 +250,7 @@ func testIntegrationWithNewDevice(t *testing.T, tester shellTester) {
|
||||
if strings.Contains(out, "thisisnotrecorded") {
|
||||
t.Fatalf("hishtory export contains a command that should not have been recorded, out=%#v", out)
|
||||
}
|
||||
expectedOutputWithoutKey := "hishtory status\nhishtory query\nls /a\nls /bar\nls /foo\necho foo\necho bar\nhishtory enable\necho thisisrecorded\nhishtory query\nhishtory query foo\necho hello | grep complex | sed s/h/i/g; echo baz && echo \"fo 'o\"\nhishtory query complex\nhishtory query\necho mynewcommand\nhishtory query\nhishtory init %s\nhishtory query\necho mynewercommand\nhishtory query\nothercomputer\nhishtory query\n"
|
||||
expectedOutputWithoutKey := "hishtory status\nhishtory query\nls /a\nls /bar\nls /foo\necho foo\necho bar\nhishtory enable\necho thisisrecorded\nhishtory query\nhishtory query foo\necho hello | grep complex | sed s/h/i/g; echo baz && echo \"fo 'o\"\nhishtory query complex\nhishtory query\necho mynewcommand\nhishtory query\nyes | hishtory init %s\nhishtory query\necho mynewercommand\nhishtory query\nothercomputer\nhishtory query\n"
|
||||
expectedOutput := fmt.Sprintf(expectedOutputWithoutKey, userSecret)
|
||||
if diff := cmp.Diff(expectedOutput, out); diff != "" {
|
||||
t.Fatalf("hishtory export mismatch (-expected +got):\n%s\nout=%#v", diff, out)
|
||||
|
Reference in New Issue
Block a user