{"size": 1221, "ext": "js", "max_stars_repo_path": "spec/integration/tag.delete-by-id.spec.js", "max_stars_repo_name": "SalathielGenese/joke-tag-api", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "spec/integration/tag.delete-by-id.spec.js", "max_issues_repo_name": "SalathielGenese/joke-tag-api", "max_issues_repo_issues_event_min_datetime": "2019-11-06T18:40:38.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-01T01:35:22.000Z", "max_forks_repo_path": "spec/integration/tag.delete-by-id.spec.js", "max_forks_repo_name": "SalathielGenese/joke-tag-api", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 4, "max_forks_count": null, "avg_line_length": 21.8035714286, "max_line_length": 101, "alphanum_fraction": 0.4283374283}
import { sequelize } from '../../models/index';
import { endpoint } from '../endpoint';
import uuid from 'uuid';



describe( 'DELETE /tag/{id}', () =>
{
    beforeEach( async () =>
    {
        label = uuid();
        tag = await Tag.create({ label });
    });

    afterEach( async () =>
    {
        await tag.destroy();
    })

    let tag;
    let label;
    const Tag = sequelize.model( 'Tag' );

    describe( 'response', () =>
    {

        describe( 'body', () =>
        {

            it( 'is object', async () =>
            {
                const { body } = await endpoint.api.delete( `/tag/${ tag.id }` ).then();

                expect( typeof body ).toBe( 'object' );
            });

            it( '.status equals "success"', async () =>
            {
                const { body: { status } } = await endpoint.api.delete( `/tag/${ tag.id }` ).then();

                expect( status ).toBe( 'success' );
            });

            it( '.content equals id of deleted tag', async () =>
            {
                const { body: { content } } = await endpoint.api.delete( `/tag/${ tag.id }` ).then();

                expect( content ).toBe( tag.id );
            });

        });

    });

});
