Skip to content

Add unit tests covering api schema changes #331

@kayle

Description

@kayle

see #330

It'd be nice to have unit tests that would catch schema changes from existing api endpoints. We can then either version the api or wait until clients are updated to be compatible with the changes.

For reference, here's the full set of apis the Windows app currently uses:

    [Route("/users/{id}")]
    class UpdateUserRequest : IReturn<string>
    {
        public long id { get; set; }
        public Dictionary<string, object> user { get; set; }
    }

    [Route("/memverses/{id}")]
    class MemverseIdRequest : IReturnVoid
    {
        public long id { get; set; }
    }

    [Route("/memverses/{id}")]
    class MemverseRatingRequest : IReturn<WebApi.RawMemverseResponse>
    {
        public long id { get; set; }
        public int q { get; set; }
    }


        [Route("/verses/{id}")]
        private class VerseByIdRequest : IReturn<VersesResponse>
        {
            public long id { get; set; }
        }

        [Route("/verses/lookup")]
        private class VerseLookupRequest : IReturn<VersesResponse>
        {
            public string tl { get; set; }
            public string bk { get; set; }
            public int ch { get; set; }
            public int vs { get; set; }
        }

        [Route("/memverses")]
        private class MemverseCreateRequest : IReturn<RawMemverseResponse>
        {
            public long id { get; set; }
        }

        [Route("/memverses")]
        private class MemverseIndexRequest : IReturn<MemversesResponse>
        {
            public string sort { get; set; }
            public int page { get; set; }
        }

and the fields being used from the corresponding responses:

    class VersesResponse
    {
        public Verse[] response { get; set; }
        public int count { get; set; }
        public Pagination pagination { get; set; }
    }
    
    class MemversesResponse
    {
        public List<RawMemverse> response { get; set; }
        public int count { get; set; }
        public Pagination pagination { get; set; }
    }

    class RawMemverse
    {
        public long id { get; set; }
        public RawVerse verse { get; set; }
        public int test_interval { get; set; }
        public int rep_n { get; set; }
        public DateTime next_test { get; set; }
        public string status { get; set; }
    }
    class RawMemverseResponse
    {
        public RawMemverse response { get; set; }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions