I’ve been following the Server Side Swift Book and now I’m kinda stuck when adding the userType.
It runs, but the tests won’t run anymore.
I’ve tried to add it on my own by using what I learned, something seems to be missing (for me) tho.
in Models+Testable.swift I added userType: UserType = .standard, in the create function and
let user = User(
name: name,
username: createUsername,
password: password,
email: "\(createUsername)@test.com",
userType: userType)
in UserTests.swift I added let usersUserType = UserType.standard and updated let user = try User.create(name: usersName, username: usersUsername, userType: usersUserType, on: app.db)
I stopped and removed the docker container and I am starting it with
Right I see what’s happening. You’re not deleting the enum in your revert. So in the first test, it creates the enum, creates the user table, runs the test then deletes the user table. Then the next next, tries to create the enum again and fails because it hasn’t been removed. So you need to change your revert to delete the enum