Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: json storage #22

Merged
merged 7 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix
  • Loading branch information
shixinhuang99 committed Nov 23, 2023
commit 64d0d628eadd70c863bafeeecf007d52a5d40d5d
4 changes: 2 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ mod tests {
if create_file {
fs::write(
temp_dir_path.join(Config::FILE_NAME),
"{\n\"token\": \"token\"\n}",
"{\n \"token\": \"token\"}",
)?;
}

Expand Down Expand Up @@ -92,7 +92,7 @@ mod tests {
config.save()?;

let content = fs::read_to_string(&config.path)?;
assert_eq!(content, "{\n\"token\": \"token2\"\n}");
assert_eq!(content, "{\n \"token\": \"token2\"}");

Ok(())
}
Expand Down
5 changes: 3 additions & 2 deletions src/json_content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ mod tests {

use anyhow::Result;
use camino::Utf8PathBuf;
use pretty_assertions::assert_eq;
use serde::{Deserialize, Serialize};
use tempfile::{tempdir, TempDir};

Expand All @@ -53,7 +54,7 @@ mod tests {
temp_dir.path().join("foo.json").into_utf8_path_buf()?;

if create_file {
fs::write(&file_path, "{\n\"bar\": \"bar\"\n}")?;
fs::write(&file_path, "{\n \"bar\": \"bar\"\n}")?;
}

let foo = Foo::load(&file_path)?;
Expand Down Expand Up @@ -88,7 +89,7 @@ mod tests {
foo.save(&file_path)?;

let content = fs::read_to_string(&file_path)?;
assert_eq!(content, "{\n\"bar\" = \"bar2\"\n}\n");
assert_eq!(content, "{\n \"bar\": \"bar2\"\n}");

Ok(())
}
Expand Down
Loading