mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-11-26 22:36:01 +03:00
29 lines
1.1 KiB
Haskell
29 lines
1.1 KiB
Haskell
module Generator.JsImportTest where
|
|
|
|
import StrongPath (Dir, Path, Posix, Rel)
|
|
import qualified StrongPath as SP
|
|
import Test.Tasty.Hspec
|
|
import Wasp.AppSpec.ExtImport
|
|
import Wasp.Generator.ExternalCodeGenerator.Common (GeneratedExternalCodeDir)
|
|
import Wasp.Generator.JsImport
|
|
import Wasp.Generator.ServerGenerator.Common (ServerSrcDir)
|
|
import Wasp.JsImport as JI
|
|
|
|
spec_GeneratorJsImportTest :: Spec
|
|
spec_GeneratorJsImportTest = do
|
|
describe "extImportToJsImport" $ do
|
|
let pathToExtCodeDir = [SP.reldirP|ext-src|] :: (Path Posix (Rel ServerSrcDir) (Dir GeneratedExternalCodeDir))
|
|
pathFromImportLocationToExtCodeDir = [SP.reldirP|../|]
|
|
extImport =
|
|
ExtImport
|
|
{ name = ExtImportModule "test",
|
|
path = [SP.relfileP|folder/test.js|]
|
|
}
|
|
it "makes a JsImport from ExtImport" $ do
|
|
extImportToJsImport pathToExtCodeDir pathFromImportLocationToExtCodeDir extImport
|
|
`shouldBe` JI.JsImport
|
|
{ JI._path = JI.RelativeImportPath [SP.relfileP|../ext-src/folder/test.js|],
|
|
JI._name = JsImportModule "test",
|
|
JI._importAlias = Nothing
|
|
}
|