Update tests with new arg for doom-initialize

This commit is contained in:
Henrik Lissner 2019-12-05 19:50:38 -05:00
parent 341e8b3531
commit d525b5502b
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 13 additions and 14 deletions

View file

@ -11,7 +11,7 @@
(defcli! test (&rest targets) (defcli! test (&rest targets)
"Run Doom unit tests." "Run Doom unit tests."
:bare t :bare t
(doom-initialize 'force) (doom-initialize 'force 'noerror)
(require 'ansi-color) (require 'ansi-color)
(let (files read-files) (let (files read-files)
(unless targets (unless targets

View file

@ -13,15 +13,15 @@
(setq doom-init-p nil)) (setq doom-init-p nil))
(it "initializes once" (it "initializes once"
(expect (doom-initialize)) (expect (doom-initialize nil 'noerror))
(expect (not (doom-initialize))) (expect (not (doom-initialize nil 'noerror)))
(expect (not (doom-initialize))) (expect (not (doom-initialize nil 'noerror)))
(expect doom-init-p)) (expect doom-init-p))
(it "initializes multiple times, if forced" (it "initializes multiple times, if forced"
(expect (doom-initialize)) (expect (doom-initialize nil 'noerror))
(expect (not (doom-initialize))) (expect (not (doom-initialize nil 'noerror)))
(expect (doom-initialize 'force))) (expect (doom-initialize 'force 'noerror)))
(describe "package initialization" (describe "package initialization"
(before-each (before-each
@ -29,18 +29,18 @@
(it "initializes packages if core autoload file doesn't exist" (it "initializes packages if core autoload file doesn't exist"
(let ((doom-autoload-file "doesnotexist")) (let ((doom-autoload-file "doesnotexist"))
(doom-initialize)) (expect (doom-initialize nil 'noerror))
(expect 'doom-initialize-packages :to-have-been-called)) (expect 'doom-initialize-packages :to-have-been-called))
(it "doesn't initialize packages if core autoload file was loaded" (it "doesn't initialize packages if core autoload file was loaded"
(let ((doom-interactive-mode t)) (let ((doom-interactive-mode t))
(spy-on 'doom-load-autoloads-file :and-return-value t) (spy-on 'doom-load-autoloads-file :and-return-value t)
(doom-initialize) (doom-initialize nil 'noerror)
(expect 'doom-load-autoloads-file :to-have-been-called-with doom-package-autoload-file) (expect 'doom-load-autoloads-file :to-have-been-called-with doom-package-autoload-file)
(expect 'doom-initialize-packages :to-have-been-called))) (expect 'doom-initialize-packages :to-have-been-called)))
(it "initializes packages when forced" (it "initializes packages when forced"
(doom-initialize 'force) (doom-initialize 'force 'noerror)
(expect 'doom-initialize-packages :to-have-been-called))) (expect 'doom-initialize-packages :to-have-been-called)))
(describe "autoloads files" (describe "autoloads files"
@ -49,15 +49,14 @@
(spy-on 'warn :and-return-value t)) (spy-on 'warn :and-return-value t))
(it "loads autoloads files" (it "loads autoloads files"
(ignore-errors (doom-initialize)) (ignore-errors (doom-initialize nil 'noerror))
(expect 'doom-load-autoloads-file (expect 'doom-load-autoloads-file
:to-have-been-called-with doom-autoload-file) :to-have-been-called-with doom-autoload-file)
(expect 'doom-load-autoloads-file (expect 'doom-load-autoloads-file
:to-have-been-called-with doom-package-autoload-file)) :to-have-been-called-with doom-package-autoload-file))
(it "throws doom-autoload-error in interactive session where autoload files don't exist" (it "throws doom-autoload-error when autoload files don't exist"
(let ((doom-interactive-mode t) (let ((doom-autoload-file "doesnotexist")
(doom-autoload-file "doesnotexist")
(doom-package-autoload-file "doesnotexist")) (doom-package-autoload-file "doesnotexist"))
(expect (doom-initialize) :to-throw 'doom-autoload-error))))) (expect (doom-initialize) :to-throw 'doom-autoload-error)))))