neutral names in docs, tests and comments (no real app or project names)
This commit is contained in:
parent
cba4660777
commit
6443a5c442
7 changed files with 28 additions and 28 deletions
|
|
@ -55,12 +55,12 @@ fn updater_has_a_real_minisign_key_and_only_storebound_dev() {
|
|||
#[test]
|
||||
fn open_deep_link_takes_one_plain_absolute_path() {
|
||||
let p = |s: &str| deep_link_open_path(&Url::parse(s).unwrap());
|
||||
let abs = if cfg!(windows) { "C:%5Cgames%5CDemo App" } else { "%2FUsers%2Fyou%2Fgames%2FDemo App" };
|
||||
let want = if cfg!(windows) { "C:\\games\\Demo App" } else { "/Users/you/games/Demo App" };
|
||||
let abs = if cfg!(windows) { "C:%5Cgames%5Cdemo-app" } else { "%2FUsers%2Fyou%2Fgames%2Fdemo-app" };
|
||||
let want = if cfg!(windows) { "C:\\games\\demo-app" } else { "/Users/you/games/demo-app" };
|
||||
assert_eq!(p(&format!("storebound://open?path={abs}")), Some(PathBuf::from(want)));
|
||||
assert_eq!(p(&format!("storebound://open/?path={abs}")), Some(PathBuf::from(want)));
|
||||
for bad in [
|
||||
"storebound://open?path=games%2FDemo App".to_string(),
|
||||
"storebound://open?path=games%2Fdemo-app".to_string(),
|
||||
"storebound://open?path=".to_string(),
|
||||
"storebound://open".to_string(),
|
||||
format!("storebound://open?path={abs}&path={abs}"),
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ fn ids_match_the_cli() {
|
|||
// cli/lib/workspace.ts accountId and cli/lib/registry.ts folderId give the same values
|
||||
assert_eq!(profiles::account_id(AccountKind::Apple, "acme"), "747351dbf2569d17");
|
||||
assert_eq!(profiles::account_id(AccountKind::Play, "default"), "82a8c2561d950999");
|
||||
assert_eq!(registry::folder_id("/w/Star Dash"), "f4994b9746e7eb18");
|
||||
assert_eq!(registry::folder_id("/w/star-dash"), "c27311c5023dc3ba");
|
||||
assert!(profiles::valid_name("default") && profiles::valid_name("acme-games.2") && !profiles::valid_name("../x") && !profiles::valid_name("-a"));
|
||||
assert_eq!(profiles::slug("Acme Games: Play!"), "acme-games-play");
|
||||
assert_eq!(profiles::slug("???"), "account");
|
||||
|
|
@ -133,19 +133,19 @@ fn project(id: &str, path: &str, play: Option<&str>) -> Project {
|
|||
fn the_folder_list_is_the_machines() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let file = dir.path().join("projects.json");
|
||||
let mut st = State { projects: vec![project("aaaaaaaaaaaaaaaa", "/w/Star Dash", Some("acc"))], ..State::default() };
|
||||
let mut st = State { projects: vec![project("aaaaaaaaaaaaaaaa", "/w/star-dash", Some("acc"))], ..State::default() };
|
||||
// first start: the app's list becomes the shared one
|
||||
assert!(!registry::sync(&mut st, &file).unwrap());
|
||||
assert_eq!(registry::read(&file).unwrap()[0].id, "aaaaaaaaaaaaaaaa");
|
||||
// the CLI adds a folder (storebound desktop / apps add): the app shows it, the first keeps its accounts
|
||||
let mut list = registry::read(&file).unwrap();
|
||||
list.push(Entry { id: registry::folder_id("/w/a game"), path: "/w/a game".into(), name: "a game".into(), added: "t".into() });
|
||||
list.push(Entry { id: registry::folder_id("/w/demo-game"), path: "/w/demo-game".into(), name: "demo-game".into(), added: "t".into() });
|
||||
registry::write(&file, &list).unwrap();
|
||||
assert!(registry::sync(&mut st, &file).unwrap());
|
||||
assert_eq!(st.projects.iter().map(|p| p.path.as_str()).collect::<Vec<_>>(), vec!["/w/Star Dash", "/w/a game"]);
|
||||
assert_eq!(st.projects.iter().map(|p| p.path.as_str()).collect::<Vec<_>>(), vec!["/w/star-dash", "/w/demo-game"]);
|
||||
assert_eq!(st.projects[0].play_account.as_deref(), Some("acc"));
|
||||
// the CLI removes one (apps remove): it leaves the app with its overrides
|
||||
st.overrides.ignored.push(format!("project:{}", registry::folder_id("/w/a game")));
|
||||
st.overrides.ignored.push(format!("project:{}", registry::folder_id("/w/demo-game")));
|
||||
registry::write(&file, &list[..1]).unwrap();
|
||||
assert!(registry::sync(&mut st, &file).unwrap());
|
||||
assert_eq!(st.projects.len(), 1);
|
||||
|
|
@ -155,7 +155,7 @@ fn the_folder_list_is_the_machines() {
|
|||
registry::write(&file, &[list[0].clone(), Entry { id: registry::folder_id("/w/cli"), path: "/w/cli".into(), name: "cli".into(), added: String::new() }]).unwrap();
|
||||
registry::publish(&st, &file, &[]).unwrap();
|
||||
let paths: Vec<String> = registry::read(&file).unwrap().into_iter().map(|e| e.path).collect();
|
||||
assert_eq!(paths, vec!["/w/Star Dash", "/w/third", "/w/cli"]);
|
||||
assert_eq!(paths, vec!["/w/star-dash", "/w/third", "/w/cli"]);
|
||||
// bad entries are dropped, not the whole file
|
||||
assert_eq!(registry::parse(r#"{"projects":[{"path":"rel"},{"path":"/a","id":"XYZ"},{"path":"/a"}]}"#).iter().map(|e| e.id.clone()).collect::<Vec<_>>(), vec![registry::folder_id("/a")]);
|
||||
}
|
||||
|
|
@ -173,7 +173,7 @@ fn store_only_apps_join_their_profiles_account_and_survive_folder_writes() {
|
|||
assert_eq!(apps.iter().map(|a| a.app_id.as_str()).collect::<Vec<_>>(), vec!["6400000999", "com.example.legacy"]);
|
||||
assert_eq!(apps[1].bundle_id.as_deref(), Some("com.example.legacy"));
|
||||
// the app writes its folder list: the store-only entries stay
|
||||
let mut st = State { projects: vec![project("aaaaaaaaaaaaaaaa", "/w/Star Dash", None)], ..State::default() };
|
||||
let mut st = State { projects: vec![project("aaaaaaaaaaaaaaaa", "/w/star-dash", None)], ..State::default() };
|
||||
registry::publish(&st, &file, &[]).unwrap();
|
||||
assert_eq!(registry::read_store_apps(&file).len(), 2);
|
||||
assert!(registry::sync(&mut st, &file).is_ok());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue